当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObjectAttribute::definition方法代码示例

本文整理汇总了PHP中eZContentObjectAttribute::definition方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectAttribute::definition方法的具体用法?PHP eZContentObjectAttribute::definition怎么用?PHP eZContentObjectAttribute::definition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObjectAttribute的用法示例。


在下文中一共展示了eZContentObjectAttribute::definition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchImageAttributesByFilepath

 /**
  * Looks up ezcontentobjectattribute entries matching an image filepath and
  * a contentobjectattribute ID
  *
  * @param string $filePath file path to look up as URL in the XML string
  * @param int $contentObjectAttributeID
  *
  * @return array An array with a series of ezcontentobject_attribute's id, version and language_code
  */
 static function fetchImageAttributesByFilepath($filepath, $contentObjectAttributeID)
 {
     $db = eZDB::instance();
     $contentObjectAttributeID = (int) $contentObjectAttributeID;
     $cond = array('id' => $contentObjectAttributeID);
     $fields = array('contentobject_id', 'contentclassattribute_id');
     $limit = array('offset' => 0, 'length' => 1);
     $rows = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), $fields, $cond, null, $limit, false);
     if (count($rows) != 1) {
         return array();
     }
     $contentObjectID = (int) $rows[0]['contentobject_id'];
     $contentClassAttributeID = (int) $rows[0]['contentclassattribute_id'];
     // Transform ", &, < and > to entities since they are being transformed in entities by DOM
     // See eZImageAliasHandler::initialize()
     // Ref https://jira.ez.no/browse/EZP-20090
     $filepath = $db->escapeString(htmlspecialchars($filepath, version_compare(PHP_VERSION, '5.4.0', '>=') ? ENT_COMPAT | ENT_HTML401 : ENT_COMPAT, 'UTF-8'));
     // Escape _ in like to avoid it to act as a wildcard !
     $filepath = addcslashes($filepath, "_");
     $query = "SELECT id, version, language_code\n                  FROM   ezcontentobject_attribute\n                  WHERE  contentobject_id = {$contentObjectID} AND\n                         contentclassattribute_id = {$contentClassAttributeID} AND\n                         data_text LIKE '%url=\"{$filepath}\"%'";
     if ($db->databaseName() == 'oracle') {
         $query .= " ESCAPE '\\'";
     }
     $rows = $db->arrayQuery($query);
     return $rows;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:35,代码来源:ezimagefile.php

示例2: definition

 /**
  * Makes the 'contentclass_attribute' attribute a 'field' instead
  * of a function attribute, for testing purposes.
  *
  * @return the overridden definition array
  */
 public static function definition()
 {
     $definitionOverride = array('fields' => array('contentclass_attribute' => array('name' => "ContentClassAttribute", 'datatype' => 'mixed')));
     $definition = array_merge_recursive(parent::definition(), $definitionOverride);
     $definition['class_name'] = __CLASS__;
     unset($definition['function_attributes']['contentclass_attribute']);
     return $definition;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:ezcontentobjectattribute_tester.php

示例3: fetchByContentObjectID

 /**
  * Fetch media objects by content object id
  * @param int $contentObjectID contentobject id
  * @param string $languageCode language code
  * @param boolean $asObject if return object
  * @return array
  */
 static function fetchByContentObjectID($contentObjectID, $languageCode = null, $asObject = true)
 {
     $condition = array();
     $condition['contentobject_id'] = $contentObjectID;
     $condition['data_type_string'] = 'ezmedia';
     if ($languageCode != null) {
         $condition['language_code'] = $languageCode;
     }
     $custom = array(array('operation' => 'DISTINCT id', 'name' => 'id'));
     $ids = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), array(), $condition, null, null, false, false, $custom);
     $mediaFiles = array();
     foreach ($ids as $id) {
         $mediaFileObjectAttribute = eZMedia::fetch($id['id'], null, $asObject);
         $mediaFiles = array_merge($mediaFiles, $mediaFileObjectAttribute);
     }
     return $mediaFiles;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:24,代码来源:ezmedia.php

示例4: fetchImageAttributesByFilepath

 /**
  * Looks up ezcontentobjectattribute entries matching an image filepath and
  * a contentobjectattribute ID
  *
  * @param string $filePath file path to look up as URL in the XML string
  * @param int $contentObjectAttributeID
  *
  * @return array An array of content object attribute ids and versions of
  *               image files where the url is referenced
  *
  * @todo Rewrite ! A where data_text LIKE '%xxx%' is a resource hog !
  */
 static function fetchImageAttributesByFilepath($filepath, $contentObjectAttributeID)
 {
     $db = eZDB::instance();
     $contentObjectAttributeID = (int) $contentObjectAttributeID;
     $cond = array('id' => $contentObjectAttributeID);
     $fields = array('contentobject_id', 'contentclassattribute_id');
     $limit = array('offset' => 0, 'length' => 1);
     $rows = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), $fields, $cond, null, $limit, false);
     if (count($rows) != 1) {
         return array();
     }
     $contentObjectID = (int) $rows[0]['contentobject_id'];
     $contentClassAttributeID = (int) $rows[0]['contentclassattribute_id'];
     $filepath = $db->escapeString($filepath);
     // Escape _ in like to avoid it to act as a wildcard !
     $filepath = addcslashes($filepath, "_");
     $query = "SELECT id, version\n                  FROM   ezcontentobject_attribute\n                  WHERE  contentobject_id = {$contentObjectID} and\n                         contentclassattribute_id = {$contentClassAttributeID} and\n                         data_text like '%url=\"{$filepath}\"%'";
     $rows = $db->arrayQuery($query);
     return $rows;
 }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例5: updateContentFromClassAttribute

 function updateContentFromClassAttribute($classAttributeID)
 {
     $asObject = true;
     $i = 0;
     $offset = 0;
     $countList = 0;
     $limit = 100;
     $conditions = array("contentclassattribute_id" => $classAttributeID);
     $limitArray = array('offset' => $offset, 'limit' => $limit);
     $sortArray = array('id' => 'asc');
     // Only fetch some objects each time to avoid memory problems.
     while (true) {
         $contentObjectAttributeList = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, $conditions, $sortArray, $limitArray, $asObject);
         if (count($contentObjectAttributeList) == 0) {
             break;
         }
         foreach ($contentObjectAttributeList as $contentObjectAttribute) {
             $this->updateContentObjectAttribute($contentObjectAttribute);
         }
         $this->Cli->output(".", false);
         $i++;
         if ($i % 70 == 0) {
             $this->Cli->output(' ' . $this->Cli->stylize('strong', $i * $limit));
         }
         $countList = count($contentObjectAttributeList);
         unset($contentObjectList);
         $offset += $limit;
         $limitArray = array('offset' => $offset, 'limit' => $limit);
     }
     $repeatLength = 70 - $i % 70;
     $count = ($i - 1) * $limit + $countList;
     $this->Cli->output(str_repeat(' ', $repeatLength) . ' ' . $this->Cli->stylize('strong', $count), false);
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:33,代码来源:ezisbn10to13converter.php

示例6: array

                }
            }
        }
        // while END
        if ($isTextModified) {
            $xmlAttribute->setAttribute('data_text', $xmlText);
            $xmlAttribute->store();
        }
    }
    // foreach END
}
// 6. fixing datatype ezobjectrelationlist
$conditions = array('contentobject_id' => '', 'data_type_string' => 'ezobjectrelationlist');
foreach ($syncObjectIDListNew as $contentObjectID) {
    $conditions['contentobject_id'] = $contentObjectID;
    $attributeList = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, $conditions);
    if (count($attributeList) == 0) {
        continue;
    }
    foreach ($attributeList as $relationListAttribute) {
        $relationsXmlText = $relationListAttribute->attribute('data_text');
        $relationsDom = eZObjectRelationListType::parseXML($relationsXmlText);
        $relationItems = $relationsDom->getElementsByTagName('relation-item');
        $isRelationModified = false;
        foreach ($relationItems as $relationItem) {
            $originalObjectID = $relationItem->getAttribute('contentobject-id');
            $key = array_search($originalObjectID, $syncObjectIDListSrc);
            if ($key !== false) {
                $newObjectID = $syncObjectIDListNew[$key];
                $relationItem->setAttribute('contentobject-id', $newObjectID);
                $isRelationModified = true;
开发者ID:nlescure,项目名称:ezpublish,代码行数:31,代码来源:ezsubtreecopy.php

示例7: fetchImageAttributesByFilepath

    /**
     * Looks up ezcontentobjectattribute entries matching an image filepath and
     * a contentobjectattribute ID
     *
     * @param string $filePath file path to look up as URL in the XML string
     * @param int $contentObjectAttributeID
     *
     * @return array An array of content object attribute ids and versions of
     *               image files where the url is referenced
     *
     * @todo Rewrite ! A where data_text LIKE '%xxx%' is a resource hog !
     */
    static function fetchImageAttributesByFilepath( $filepath, $contentObjectAttributeID )
    {
        $db = eZDB::instance();
        $contentObjectAttributeID = (int) $contentObjectAttributeID;

        $cond = array( 'id' => $contentObjectAttributeID );
        $fields = array( 'contentobject_id', 'contentclassattribute_id' );
        $limit = array( 'offset' => 0, 'length' => 1 );
        $rows = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(),
                                                     $fields,
                                                     $cond,
                                                     null,
                                                     $limit,
                                                     false );
        if ( count( $rows ) != 1 )
            return array();

        $contentObjectID = (int)( $rows[0]['contentobject_id'] );
        $contentClassAttributeID = (int)( $rows[0]['contentclassattribute_id'] );
        $filepath = $db->escapeString( $filepath );
        $query = "SELECT id, version
                  FROM   ezcontentobject_attribute
                  WHERE  contentobject_id = $contentObjectID and
                         contentclassattribute_id = $contentClassAttributeID and
                         data_text like '%url=\"$filepath\"%'";
        $rows = $db->arrayQuery( $query );
        return $rows;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:40,代码来源:ezimagefile.php

示例8: allContentObjectAttributes

 /**
  * Fetches all attributes from any versions of the content object
  *
  * @param int $contentObjectID
  * @param bool $asObject
  * @param array|null $limit the limit array passed to {@see eZPersistentObject::fetchObjectList}
  * @return eZContentObjectAttribute[]|array|null
  */
 function allContentObjectAttributes( $contentObjectID, $asObject = true, $limit = null )
 {
     return eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(),
                                                 null,
                                                 array("contentobject_id" => $contentObjectID ),
                                                 null,
                                                 $limit,
                                                 $asObject );
 }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:17,代码来源:ezcontentobject.php

示例9: getPaEx

 /**
  * Get actual values for PaEx data for the given contentobject id.
  * If not defined for the given coID, use defaults.
  *
  * @param int $ezcoid Contentobject id (user id) to get PaEx for
  * @param bool $checkIfUserHasDatatype See if user has paex datatype, default false
  * @return eZPaEx|null Actual PaEx applicable data, null if $checkIfUserHasDatatype = true
  *                     and object does not have ezpaex datatype
  */
 static function getPaEx($ezcoid, $checkIfUserHasDatatype = false)
 {
     $currentPaex = eZPaEx::fetch($ezcoid);
     // If we don't have paex object for the current object id, create a default one
     if (!$currentPaex instanceof eZPaEx) {
         // unless user does not have paex datatype
         if ($checkIfUserHasDatatype) {
             //eZContentObject::fetch( $ezcoid );
             $paexDataTypeCount = eZPersistentObject::count(eZContentObjectAttribute::definition(), array('contentobject_id' => $ezcoid, 'data_type_string' => ezpaextype::DATA_TYPE_STRING), 'id');
             if (!$paexDataTypeCount) {
                 eZDebug::writeDebug("User id {$ezcoid} does not have paex datatype", __METHOD__);
                 return null;
             }
         }
         return eZPaEx::create($ezcoid);
     }
     // Get default paex values from ini to use in case there is anyone missing in the object
     $ini = eZINI::instance('mbpaex.ini');
     $iniPasswordValidationRegexp = $ini->variable('mbpaexSettings', 'PasswordValidationRegexp');
     $iniDefaultPasswordLifeTime = $ini->variable('mbpaexSettings', 'DefaultPasswordLifeTime');
     $iniExpirationNotification = $ini->variable('mbpaexSettings', 'ExpirationNotification');
     // If still any empty values in the paex object, set defaults from ini
     if (!$currentPaex->hasRegexp()) {
         $currentPaex->setAttribute('passwordvalidationregexp', $iniPasswordValidationRegexp);
         eZDebug::writeDebug('Regexp empty, used default: "' . $iniPasswordValidationRegexp . '"', 'eZPaEx::getPaEx');
     }
     if (!$currentPaex->hasLifeTime()) {
         $currentPaex->setAttribute('passwordlifetime', $iniDefaultPasswordLifeTime);
         eZDebug::writeDebug('PasswordLifeTime empty, used default: "' . $iniDefaultPasswordLifeTime . '"', 'eZPaEx::getPaEx');
     }
     if (!$currentPaex->hasNotification()) {
         $currentPaex->setAttribute('expirationnotification', $iniExpirationNotification);
         eZDebug::writeDebug('ExpirationNotification empty, used default: "' . $iniPasswordValidationRegexp . '"', 'eZPaEx::getPaEx');
     }
     eZDebug::writeDebug('PasswordLastUpdated value: "' . $currentPaex->attribute('password_last_updated') . '"', 'eZPaEx::getPaEx');
     return $currentPaex;
 }
开发者ID:netbliss,项目名称:ezmbpaex,代码行数:46,代码来源:ezpaex.php

示例10: array

            continue;
        }
    } else {
        $cli->output("  Moving file to {$newPath}");
    }
    if (!$optDryRun && $moveFile) {
        $clusterHandler->fileMove($filePath, $newPath);
        $db->query("UPDATE ezimagefile SET filepath = '{$newPath}' WHERE contentobject_attribute_id = {$imageAttributeId}");
    }
    if (!isset($renamedFiles[$imageAttributeId])) {
        $renamedFiles[$imageAttributeId] = array();
    }
    $renamedFiles[$imageAttributeId][$filePath] = $newPath;
}
foreach ($renamedFiles as $attributeId => $files) {
    $attributeObjects = eZContentObjectAttribute::fetchObjectList(eZContentObjectAttribute::definition(), null, array('id' => $attributeId));
    /** @var eZContentObjectAttribute $attributeObject */
    foreach ($attributeObjects as $attributeObject) {
        $dom = new DOMDocument('1.0', 'utf-8');
        if (!$dom->loadXML($attributeObject->attribute('data_text'))) {
            continue;
        }
        foreach ($dom->getElementsByTagName('ezimage') as $ezimageNode) {
            // Update main image
            $oldPath = $ezimageNode->getAttribute('url');
            if (isset($files[$oldPath])) {
                $ezimageNode->setAttribute('url', $files[$oldPath]);
                $ezimageNode->setAttribute('dirpath', dirname($files[$oldPath]));
            }
            // Update aliases
            foreach ($ezimageNode->getElementsByTagName('alias') as $ezimageAlias) {
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:fiximagesoutsidevardir.php

示例11: array

<?php

$db = eZDB::instance();
$offset = 0;
$length = 100;
$cond = array('data_type_string' => xrowMetaDataType::DATA_TYPE_STRING);
$count = eZPersistentObject::count(eZContentObjectAttribute::definition(), $cond);
echo "There are {$count} priorities to reset.\n";
$output = new ezcConsoleOutput();
$bar = new ezcConsoleProgressbar($output, $count / $length);
$limit = array('offset' => $offset, 'length' => $length);
$list = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, $cond, null, $limit);
while (!empty($list)) {
    $db->begin();
    /* var eZContentObjectAttribute */
    foreach ($list as $attribute) {
        /* var xrowMetaData */
        $data = $attribute->content();
        $data->priority = null;
        $attribute->setContent($data);
        $attribute->store();
    }
    $db->commit();
    $bar->advance();
    $offset = $offset + $length;
    $limit = array('offset' => $offset, 'length' => $length);
    $list = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, $cond, null, $limit);
}
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:28,代码来源:resetallpriorities.php

示例12: sleep

$script = eZScript::instance(array('description' => "Migrates sckenhancedselection datatype to version which stores content object data to database table.", 'use-session' => true, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$script->getOptions();
$script->initialize();
$cli->warning("This script will NOT republish objects, but rather update ALL versions");
$cli->warning("of content objects. If you do not wish to do that, you have");
$cli->warning("15 seconds to cancel the script! (press Ctrl-C)\n");
sleep(15);
$db = eZDB::instance();
$offset = 0;
$limit = 50;
$attributeCount = (int) eZPersistentObject::count(eZContentObjectAttribute::definition(), array('data_type_string' => 'sckenhancedselection'));
while ($offset < $attributeCount) {
    eZContentObject::clearCache();
    /** @var eZContentObjectAttribute[] $attributes */
    $attributes = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('data_type_string' => 'sckenhancedselection'), null, array('offset' => $offset, 'length' => $limit));
    foreach ($attributes as $attribute) {
        SckEnhancedSelection::removeByAttribute($attribute->attribute('id'), $attribute->attribute('version'));
        $identifiers = unserialize((string) $attribute->attribute('data_text'));
        if (is_array($identifiers) && !empty($identifiers)) {
            foreach ($identifiers as $identifier) {
                $sckEnhancedSelection = new SckEnhancedSelection(array('contentobject_attribute_id' => $attribute->attribute('id'), 'contentobject_attribute_version' => $attribute->attribute('version'), 'identifier' => $identifier));
                $sckEnhancedSelection->store();
            }
        }
        $attribute->setAttribute('data_text', null);
        $attribute->store();
        $cli->output("Converted attribute #{$attribute->attribute('id')} in version {$attribute->attribute('version')}");
    }
    unset($attributes);
    $offset += $limit;
开发者ID:netgen,项目名称:enhancedselection2,代码行数:31,代码来源:migrate_to_database.php

示例13: removeRelationObject

 static function removeRelationObject($contentObjectAttribute, $deletionItem)
 {
     if (self::isItemPublished($deletionItem)) {
         return;
     }
     $hostObject = $contentObjectAttribute->attribute('object');
     $hostObjectID = $hostObject->attribute('id');
     // Do not try removing the object if present in trash
     // Only objects being really orphaned (not even being in trash) should be removed by this method.
     // See issue #019457
     if ((int) eZPersistentObject::count(eZContentObjectTrashNode::definition(), array("contentobject_id" => $hostObjectID)) > 0) {
         return;
     }
     $hostObjectVersions = $hostObject->versions();
     $isDeletionAllowed = true;
     // check if the relation item to be deleted is unique in the domain of all host-object versions
     foreach ($hostObjectVersions as $version) {
         if ($isDeletionAllowed and $version->attribute('version') != $contentObjectAttribute->attribute('version')) {
             $relationAttribute = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('version' => $version->attribute('version'), 'contentobject_id' => $hostObjectID, 'contentclassattribute_id' => $contentObjectAttribute->attribute('contentclassattribute_id')));
             if (count($relationAttribute) > 0) {
                 $relationContent = $relationAttribute[0]->content();
                 if (is_array($relationContent) and is_array($relationContent['relation_list'])) {
                     foreach ($relationContent['relation_list'] as $relationItem) {
                         if ($deletionItem['contentobject_id'] == $relationItem['contentobject_id'] && $deletionItem['contentobject_version'] == $relationItem['contentobject_version']) {
                             $isDeletionAllowed = false;
                             break 2;
                         }
                     }
                 }
             }
         }
     }
     if ($isDeletionAllowed) {
         $subObjectVersion = eZContentObjectVersion::fetchVersion($deletionItem['contentobject_version'], $deletionItem['contentobject_id']);
         if ($subObjectVersion instanceof eZContentObjectVersion) {
             $subObjectVersion->removeThis();
         } else {
             eZDebug::writeError('Cleanup of subobject-version failed. Could not fetch object from relation list.\\n' . 'Requested subobject id: ' . $deletionItem['contentobject_id'] . '\\n' . 'Requested Subobject version: ' . $deletionItem['contentobject_version'], __METHOD__);
         }
     }
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:41,代码来源:ezobjectrelationlisttype.php

示例14: array

/**
 * File containing the ${NAME} class.
 *
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version 2014.11.1
 */
require_once 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "Re-creates missing references to image files in ezimagefile. See issue EZP-21324\n", 'use-session' => true, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[dry-run]", "", array('n' => 'Dry run'));
$optDryRun = (bool) $options['dry-run'];
$script->initialize();
$imageAttributes = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), array('id', 'contentobject_id', 'version', 'data_text'), array('data_type_string' => 'ezimage'), null, null, false);
$cli->output("Re-creating missing ezcontentobject_attribute / ezimagefile references");
if ($optDryRun) {
    $cli->warning("dry-run mode");
}
foreach ($imageAttributes as $imageAttribute) {
    if (($doc = simplexml_load_string($imageAttribute["data_text"])) === false) {
        continue;
    }
    // Creates ezimagefile entries
    foreach ($doc->xpath("//*/@url") as $url) {
        $url = (string) $url;
        echo "Processing {$imageAttribute['contentobject_id']}#{$imageAttribute['version']} ({$url})\n";
        if ($url === "") {
            continue;
        }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:30,代码来源:recreateimagesreferences.php

示例15: contentObject

 /**
  * Return the contentObject.
  * 
  * @return void
  */
 public function contentObject()
 {
     $singleAttributeList = ezPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('id' => $this->attribute('contentobjectattribute_id')), null, 1, true);
     $singleAttribute = $singleAttributeList[0];
     return $singleAttribute->attribute('object');
 }
开发者ID:kmajkowski,项目名称:ymc-ezp-datatypes,代码行数:11,代码来源:ymcinstantmessenger.php


注:本文中的eZContentObjectAttribute::definition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。