diff --git a/application/Module.php b/application/Module.php index fa9fa57232..a26e63c541 100644 --- a/application/Module.php +++ b/application/Module.php @@ -366,15 +366,16 @@ public function filterMedia(ZendEvent $event) $qb->innerJoin('omeka_root.item', $itemAlias); // Users can view media they do not own that belong to public items. - $expression = $qb->expr()->eq("$itemAlias.isPublic", true); + $expr = $qb->expr(); + $expression = $expr->eq("$itemAlias.isPublic", true); $identity = $this->getServiceLocator() ->get('Omeka\AuthenticationService')->getIdentity(); if ($identity) { // Users can view all media they own. - $expression = $qb->expr()->orX( + $expression = $expr->orX( $expression, - $qb->expr()->eq( + $expr->eq( "$itemAlias.owner", $adapter->createNamedParameter($qb, $identity) ) @@ -399,7 +400,8 @@ public function filterSites(ZendEvent $event) $qb = $event->getParam('queryBuilder'); // Users can view sites they do not own that are public. - $expression = $qb->expr()->eq("omeka_root.isPublic", true); + $expr = $qb->expr(); + $expression = $expr->eq("omeka_root.isPublic", true); $identity = $this->getServiceLocator() ->get('Omeka\AuthenticationService')->getIdentity(); @@ -407,15 +409,15 @@ public function filterSites(ZendEvent $event) $sitePermissionAlias = $adapter->createAlias(); $qb->leftJoin('omeka_root.sitePermissions', $sitePermissionAlias); - $expression = $qb->expr()->orX( + $expression = $expr->orX( $expression, // Users can view all sites they own. - $qb->expr()->eq( + $expr->eq( 'omeka_root.owner', $adapter->createNamedParameter($qb, $identity) ), // Users can view sites where they have a role (any role). - $qb->expr()->eq( + $expr->eq( "$sitePermissionAlias.user", $adapter->createNamedParameter($qb, $identity) ) diff --git a/application/asset/js/admin.js b/application/asset/js/admin.js index 9a475c4554..e28065985c 100644 --- a/application/asset/js/admin.js +++ b/application/asset/js/admin.js @@ -196,7 +196,7 @@ $('.batch-edit td input[type="checkbox"]').change(function() { if ($('.select-all:checked').length > 0) { - $('.select-all').prop('checked', false); + $('.select-all').prop('checked', false); } Omeka.manageSelectedActions(); }); diff --git a/application/asset/js/ckeditor_config.js b/application/asset/js/ckeditor_config.js index ba5d662f25..c7b27373e8 100644 --- a/application/asset/js/ckeditor_config.js +++ b/application/asset/js/ckeditor_config.js @@ -1,29 +1,31 @@ /** * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or http://ckeditor.com/license + * For licensing, see LICENSE.md or https://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. // For complete reference see: - // http://docs.ckeditor.com/#!/api/CKEDITOR.config + // https://docs.ckeditor.com/#!/api/CKEDITOR.config config.toolbar = [ - { "name" : "advanced", "items" : - ['Sourcedialog', '-', - 'Link', 'Unlink', 'Anchor', '-', - 'Format', 'Styles', 'PasteFromWord' - ] - }, - "/", - { "items" : - ['Bold', 'Italic', 'Underline', 'Strike', '-', - 'NumberedList', 'BulletedList', 'Indent', 'Outdent', 'Blockquote' - ] - } - ]; + { + 'name': 'advanced', + 'items': [ + 'Sourcedialog', '-', + 'Link', 'Unlink', 'Anchor', '-', + 'Format', 'Styles', 'PasteFromWord', + ], + }, + '/', + { + 'items': [ + 'Bold', 'Italic', 'Underline', 'Strike', '-', + 'NumberedList', 'BulletedList', 'Indent', 'Outdent', 'Blockquote', + ], + }, + ]; // Disable content filtering config.allowedContent = true; config.extraPlugins = 'sourcedialog'; }; - diff --git a/application/src/Api/Adapter/AbstractEntityAdapter.php b/application/src/Api/Adapter/AbstractEntityAdapter.php index 439b398fee..14ef4226fd 100644 --- a/application/src/Api/Adapter/AbstractEntityAdapter.php +++ b/application/src/Api/Adapter/AbstractEntityAdapter.php @@ -7,8 +7,8 @@ use Omeka\Api\Exception; use Omeka\Api\Request; use Omeka\Api\Response; -use Omeka\Entity\User; use Omeka\Entity\EntityInterface; +use Omeka\Entity\User; use Omeka\Stdlib\ErrorStore; use Laminas\EventManager\Event; @@ -212,28 +212,16 @@ public function search(Request $request) $query = $request->getContent(); // Set default query parameters - if (!isset($query['page'])) { - $query['page'] = null; - } - if (!isset($query['per_page'])) { - $query['per_page'] = null; - } - if (!isset($query['limit'])) { - $query['limit'] = null; - } - if (!isset($query['offset'])) { - $query['offset'] = null; - } - if (!isset($query['sort_by'])) { - $query['sort_by'] = null; - } - if (isset($query['sort_order']) - && in_array(strtoupper($query['sort_order']), ['ASC', 'DESC']) - ) { - $query['sort_order'] = strtoupper($query['sort_order']); - } else { - $query['sort_order'] = 'ASC'; - } + $defaultQuery = [ + 'page' => null, + 'per_page' => null, + 'limit' => null, + 'offset' => null, + 'sort_by' => null, + 'sort_order' => null, + ]; + $query += $defaultQuery; + $query['sort_order'] = strtoupper($query['sort_order']) === 'DESC' ? 'DESC' : 'ASC'; // Begin building the search query. $entityClass = $this->getEntityClass(); @@ -667,8 +655,9 @@ public function findEntity($criteria, $request = null) $this->index = 0; $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('omeka_root')->from($entityClass, 'omeka_root'); + $expr = $qb->expr(); foreach ($criteria as $field => $value) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.$field", $this->createNamedParameter($qb, $value) )); @@ -747,18 +736,19 @@ public function isUnique(EntityInterface $entity, array $criteria) $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('e.id') ->from($this->getEntityClass(), 'e'); + $expr = $qb->expr(); // Exclude the passed entity from the query if it has an persistent // indentifier. if ($entity->getId()) { - $qb->andWhere($qb->expr()->neq( + $qb->andWhere($expr->neq( 'e.id', $this->createNamedParameter($qb, $entity->getId()) )); } foreach ($criteria as $field => $value) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "e.$field", $this->createNamedParameter($qb, $value) )); diff --git a/application/src/Api/Adapter/AbstractResourceEntityAdapter.php b/application/src/Api/Adapter/AbstractResourceEntityAdapter.php index a788dbd0ca..fc27c54a7f 100644 --- a/application/src/Api/Adapter/AbstractResourceEntityAdapter.php +++ b/application/src/Api/Adapter/AbstractResourceEntityAdapter.php @@ -15,6 +15,7 @@ abstract class AbstractResourceEntityAdapter extends AbstractEntityAdapter imple public function buildQuery(QueryBuilder $qb, array $query) { $this->buildPropertyQuery($qb, $query); + $expr = $qb->expr(); if (isset($query['search'])) { $this->buildPropertyQuery($qb, ['property' => [[ @@ -30,7 +31,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.owner', $userAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$userAlias.id", $this->createNamedParameter($qb, $query['owner_id'])) ); @@ -42,7 +43,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.resourceClass', $resourceClassAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$resourceClassAlias.label", $this->createNamedParameter($qb, $query['resource_class_label'])) ); @@ -55,7 +56,7 @@ public function buildQuery(QueryBuilder $qb, array $query) } $classes = array_filter($classes, 'is_numeric'); if ($classes) { - $qb->andWhere($qb->expr()->in( + $qb->andWhere($expr->in( 'omeka_root.resourceClass', $this->createNamedParameter($qb, $classes) )); @@ -68,7 +69,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.resourceTemplate', $resourceTemplateAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$resourceTemplateAlias.label", $this->createNamedParameter($qb, $query['resource_template_label'])) ); @@ -81,7 +82,7 @@ public function buildQuery(QueryBuilder $qb, array $query) } $templates = array_filter($templates, 'is_numeric'); if ($templates) { - $qb->andWhere($qb->expr()->in( + $qb->andWhere($expr->in( 'omeka_root.resourceTemplate', $this->createNamedParameter($qb, $templates) )); @@ -89,7 +90,7 @@ public function buildQuery(QueryBuilder $qb, array $query) } if (isset($query['is_public']) && (is_numeric($query['is_public']) || is_bool($query['is_public']))) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( 'omeka_root.isPublic', $this->createNamedParameter($qb, (bool) $query['is_public']) )); @@ -131,7 +132,7 @@ public function sortQuery(QueryBuilder $qb, array $query) public function hydrate(Request $request, EntityInterface $entity, ErrorStore $errorStore ) { - $data = $request->getContent(); + // $data = $request->getContent(); if ($this->shouldHydrate($request, 'o:is_public')) { $entity->setIsPublic($request->getValue('o:is_public', true)); @@ -209,8 +210,12 @@ protected function buildPropertyQuery(QueryBuilder $qb, array $query) if (!isset($query['property']) || !is_array($query['property'])) { return; } + + $expr = $qb->expr(); $valuesJoin = 'omeka_root.values'; $where = ''; + // @see \Doctrine\ORM\QueryBuilder::expr(). + $expr = $qb->expr(); foreach ($query['property'] as $queryRow) { if (!(is_array($queryRow) @@ -241,11 +246,11 @@ protected function buildPropertyQuery(QueryBuilder $qb, array $query) ->createQueryBuilder() ->select("$subqueryAlias.id") ->from('Omeka\Entity\Resource', $subqueryAlias) - ->where($qb->expr()->eq("$subqueryAlias.title", $param)); - $predicateExpr = $qb->expr()->orX( - $qb->expr()->in("$valuesAlias.valueResource", $subquery->getDQL()), - $qb->expr()->eq("$valuesAlias.value", $param), - $qb->expr()->eq("$valuesAlias.uri", $param) + ->where($expr->eq("$subqueryAlias.title", $param)); + $predicateExpr = $expr->orX( + $expr->in("$valuesAlias.valueResource", $subquery->getDQL()), + $expr->eq("$valuesAlias.value", $param), + $expr->eq("$valuesAlias.uri", $param) ); break; case 'nin': @@ -257,17 +262,18 @@ protected function buildPropertyQuery(QueryBuilder $qb, array $query) ->createQueryBuilder() ->select("$subqueryAlias.id") ->from('Omeka\Entity\Resource', $subqueryAlias) - ->where($qb->expr()->like("$subqueryAlias.title", $param)); - $predicateExpr = $qb->expr()->orX( - $qb->expr()->in("$valuesAlias.valueResource", $subquery->getDQL()), - $qb->expr()->like("$valuesAlias.value", $param), - $qb->expr()->like("$valuesAlias.uri", $param) + ->where($expr->like("$subqueryAlias.title", $param)); + $predicateExpr = $expr->orX( + $expr->in("$valuesAlias.valueResource", $subquery->getDQL()), + $expr->like("$valuesAlias.value", $param), + $expr->like("$valuesAlias.uri", $param) ); break; + case 'nres': $positive = false; case 'res': - $predicateExpr = $qb->expr()->eq( + $predicateExpr = $expr->eq( "$valuesAlias.valueResource", $this->createNamedParameter($qb, $value) ); @@ -275,7 +281,7 @@ protected function buildPropertyQuery(QueryBuilder $qb, array $query) case 'nex': $positive = false; case 'ex': - $predicateExpr = $qb->expr()->isNotNull("$valuesAlias.id"); + $predicateExpr = $expr->isNotNull("$valuesAlias.id"); break; default: continue 2; @@ -294,18 +300,18 @@ protected function buildPropertyQuery(QueryBuilder $qb, array $query) $propertyId = 0; } } - $joinConditions[] = $qb->expr()->eq("$valuesAlias.property", (int) $propertyId); + $joinConditions[] = $expr->eq("$valuesAlias.property", (int) $propertyId); } if ($positive) { $whereClause = '(' . $predicateExpr . ')'; } else { $joinConditions[] = $predicateExpr; - $whereClause = $qb->expr()->isNull("$valuesAlias.id"); + $whereClause = $expr->isNull("$valuesAlias.id"); } if ($joinConditions) { - $qb->leftJoin($valuesJoin, $valuesAlias, 'WITH', $qb->expr()->andX(...$joinConditions)); + $qb->leftJoin($valuesJoin, $valuesAlias, 'WITH', $expr->andX(...$joinConditions)); } else { $qb->leftJoin($valuesJoin, $valuesAlias); } @@ -369,26 +375,27 @@ public function getSubjectValues(Resource $resource, $page = null, $perPage = nu $em = $this->getEntityManager(); $qb = $em->createQueryBuilder(); + $expr = $qb->expr(); $qb->select('v') ->from('Omeka\Entity\Value', 'v') ->join('v.resource', 'r') - ->where($qb->expr()->eq('v.valueResource', $this->createNamedParameter($qb, $resource))) + ->where($expr->eq('v.valueResource', $this->createNamedParameter($qb, $resource))) // Limit subject values to those belonging to primary resources. - ->andWhere($qb->expr()->orX( + ->andWhere($expr->orX( 'r INSTANCE OF Omeka\Entity\Item', 'r INSTANCE OF Omeka\Entity\ItemSet', 'r INSTANCE OF Omeka\Entity\Media' )); if (!$acl->userIsAllowed('Omeka\Entity\Resource', 'view-all')) { - $qb->andWhere($qb->expr()->orX( - $qb->expr()->eq('r.isPublic', '1'), - $qb->expr()->eq('r.owner', $this->createNamedParameter($qb, $identity)) + $qb->andWhere($expr->orX( + $expr->eq('r.isPublic', '1'), + $expr->eq('r.owner', $this->createNamedParameter($qb, $identity)) )); } if ($property) { - $qb->andWhere($qb->expr()->eq('v.property', $this->createNamedParameter($qb, $property))); + $qb->andWhere($expr->eq('v.property', $this->createNamedParameter($qb, $property))); } $qb->setMaxResults($perPage); diff --git a/application/src/Api/Adapter/AssetAdapter.php b/application/src/Api/Adapter/AssetAdapter.php index f27ebf28b9..e27219a31e 100644 --- a/application/src/Api/Adapter/AssetAdapter.php +++ b/application/src/Api/Adapter/AssetAdapter.php @@ -55,7 +55,7 @@ public function buildQuery(QueryBuilder $qb, array $query) public function hydrate(Request $request, EntityInterface $entity, ErrorStore $errorStore) { - $data = $request->getContent(); + // $data = $request->getContent(); if (Request::CREATE === $request->getOperation()) { $fileData = $request->getFileData(); diff --git a/application/src/Api/Adapter/ItemSetAdapter.php b/application/src/Api/Adapter/ItemSetAdapter.php index f32d02d3b7..ceea4ad7cf 100644 --- a/application/src/Api/Adapter/ItemSetAdapter.php +++ b/application/src/Api/Adapter/ItemSetAdapter.php @@ -46,16 +46,17 @@ public function buildQuery(QueryBuilder $qb, array $query) if (isset($query['is_open'])) { $acl = $this->getServiceLocator()->get('Omeka\Acl'); if (!$acl->userIsAllowed('Omeka\Entity\ItemSet', 'view-all')) { - $expr = $qb->expr()->eq( + $expr = $qb->expr(); + $expression = $expr->eq( 'omeka_root.isOpen', - $qb->expr()->literal(true) + $expr->literal(true) ); $identity = $this->getServiceLocator() ->get('Omeka\AuthenticationService')->getIdentity(); if ($identity) { - $expr = $qb->expr()->orX( - $expr, - $qb->expr()->eq( + $expression = $expr->orX( + $expression, + $expr->eq( 'omeka_root.owner', $this->createNamedParameter($qb, $identity->getId()) ) diff --git a/application/src/Api/Adapter/JobAdapter.php b/application/src/Api/Adapter/JobAdapter.php index 61629751ab..ee8af859ba 100644 --- a/application/src/Api/Adapter/JobAdapter.php +++ b/application/src/Api/Adapter/JobAdapter.php @@ -57,6 +57,12 @@ public function buildQuery(QueryBuilder $qb, array $query) $this->createNamedParameter($qb, $query['class'])) ); } + if (isset($query['status'])) { + $qb->andWhere($qb->expr()->eq( + $this->getEntityClass() . '.status', + $this->createNamedParameter($qb, $query['status'])) + ); + } if (isset($query['status'])) { $qb->andWhere($qb->expr()->eq( 'omeka_root.status', diff --git a/application/src/Api/Adapter/PropertyAdapter.php b/application/src/Api/Adapter/PropertyAdapter.php index b287686125..1143f1cf6a 100644 --- a/application/src/Api/Adapter/PropertyAdapter.php +++ b/application/src/Api/Adapter/PropertyAdapter.php @@ -71,13 +71,14 @@ public function hydrate(Request $request, EntityInterface $entity, public function buildQuery(QueryBuilder $qb, array $query) { + $expr = $qb->expr(); if (isset($query['owner_id']) && is_numeric($query['owner_id'])) { $userAlias = $this->createAlias(); $qb->innerJoin( 'omeka_root.owner', $userAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$userAlias.id", $this->createNamedParameter($qb, $query['owner_id'])) ); @@ -88,7 +89,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.id", $this->createNamedParameter($qb, $query['vocabulary_id'])) ); @@ -99,7 +100,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.namespaceUri", $this->createNamedParameter($qb, $query['vocabulary_namespace_uri'])) ); @@ -110,13 +111,13 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.prefix", $this->createNamedParameter($qb, $query['vocabulary_prefix'])) ); } if (isset($query['local_name'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.localName", $this->createNamedParameter($qb, $query['local_name'])) ); @@ -128,11 +129,11 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.prefix", $this->createNamedParameter($qb, $prefix)) ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.localName", $this->createNamedParameter($qb, $localName)) ); diff --git a/application/src/Api/Adapter/ResourceClassAdapter.php b/application/src/Api/Adapter/ResourceClassAdapter.php index cac78371c0..24952b4054 100644 --- a/application/src/Api/Adapter/ResourceClassAdapter.php +++ b/application/src/Api/Adapter/ResourceClassAdapter.php @@ -46,7 +46,7 @@ public function sortQuery(QueryBuilder $qb, array $query) public function hydrate(Request $request, EntityInterface $entity, ErrorStore $errorStore ) { - $data = $request->getContent(); + // $data = $request->getContent(); $this->hydrateOwner($request, $entity); if ($this->shouldHydrate($request, 'o:local_name')) { @@ -62,13 +62,14 @@ public function hydrate(Request $request, EntityInterface $entity, public function buildQuery(QueryBuilder $qb, array $query) { + $expr = $qb->expr(); if (isset($query['owner_id']) && is_numeric($query['owner_id'])) { $userAlias = $this->createAlias(); $qb->innerJoin( 'omeka_root.owner', $userAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$userAlias.id", $this->createNamedParameter($qb, $query['owner_id'])) ); @@ -79,7 +80,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.id", $this->createNamedParameter($qb, $query['vocabulary_id'])) ); @@ -90,7 +91,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.namespaceUri", $this->createNamedParameter($qb, $query['vocabulary_namespace_uri'])) ); @@ -101,13 +102,13 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.prefix", $this->createNamedParameter($qb, $query['vocabulary_prefix'])) ); } if (isset($query['local_name'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.localName", $this->createNamedParameter($qb, $query['local_name'])) ); @@ -119,11 +120,11 @@ public function buildQuery(QueryBuilder $qb, array $query) 'omeka_root.vocabulary', $vocabularyAlias ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$vocabularyAlias.prefix", $this->createNamedParameter($qb, $prefix)) ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.localName", $this->createNamedParameter($qb, $localName)) ); diff --git a/application/src/Api/Adapter/UserAdapter.php b/application/src/Api/Adapter/UserAdapter.php index cd65031a36..ae8bf3f6dd 100644 --- a/application/src/Api/Adapter/UserAdapter.php +++ b/application/src/Api/Adapter/UserAdapter.php @@ -71,29 +71,30 @@ public function hydrate(Request $request, EntityInterface $entity, public function buildQuery(QueryBuilder $qb, array $query) { + $expr = $qb->expr(); if (!empty($query['email'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.email", $this->createNamedParameter($qb, $query['email'])) ); } if (!empty($query['name'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "omeka_root.name", $this->createNamedParameter($qb, $query['name'])) ); } if (!empty($query['role'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( 'omeka_root.role', $this->createNamedParameter($qb, $query['role'])) ); } if (isset($query['is_active']) && is_numeric($query['is_active'])) { - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( 'omeka_root.isActive', $this->createNamedParameter($qb, (bool) $query['is_active'])) ); @@ -107,7 +108,7 @@ public function buildQuery(QueryBuilder $qb, array $query) 'WITH', $sitePermissionAlias . '.user = omeka_root' ); - $qb->andWhere($qb->expr()->eq( + $qb->andWhere($expr->eq( "$sitePermissionAlias.site", $this->createNamedParameter($qb, $query['site_permission_site_id'])) ); diff --git a/application/src/Api/Representation/AbstractRepresentation.php b/application/src/Api/Representation/AbstractRepresentation.php index e0b22e7d5a..dbb53c2e38 100644 --- a/application/src/Api/Representation/AbstractRepresentation.php +++ b/application/src/Api/Representation/AbstractRepresentation.php @@ -97,7 +97,7 @@ public function primaryMedia() /** * Get one thumbnail of this representation. * - * @return Asset + * @return AssetRepresentation|null */ public function thumbnail() { diff --git a/application/src/Api/Representation/AbstractResourceEntityRepresentation.php b/application/src/Api/Representation/AbstractResourceEntityRepresentation.php index b4a84d8a97..3cbdcfd69b 100644 --- a/application/src/Api/Representation/AbstractResourceEntityRepresentation.php +++ b/application/src/Api/Representation/AbstractResourceEntityRepresentation.php @@ -326,12 +326,13 @@ public function values() public function value($term, array $options = []) { // Set defaults. - if (!isset($options['all'])) { - $options['all'] = false; - } - if (!isset($options['default'])) { - $options['default'] = $options['all'] ? [] : null; - } + $defaultOptions = [ + 'type' => null, + 'all' => false, + 'default' => empty($options['all']) ? null : [], + 'lang' => null, + ]; + $options += $defaultOptions; if (!$this->getAdapter()->isTerm($term)) { return $options['default']; diff --git a/application/src/Api/Representation/AbstractResourceRepresentation.php b/application/src/Api/Representation/AbstractResourceRepresentation.php index df28a7e087..ae83149686 100644 --- a/application/src/Api/Representation/AbstractResourceRepresentation.php +++ b/application/src/Api/Representation/AbstractResourceRepresentation.php @@ -173,11 +173,11 @@ public function apiUrl() public function url($action = null, $canonical = false) { $status = $this->getServiceLocator()->get('Omeka\Status'); - $routeMatch = $status->getRouteMatch(); $url = null; if ($status->isAdminRequest()) { $url = $this->adminUrl($action, $canonical); } elseif ($status->isSiteRequest()) { + $routeMatch = $status->getRouteMatch(); $url = $this->siteUrl($routeMatch->getParam('site-slug'), $canonical); } return $url; diff --git a/application/src/Api/Representation/ItemRepresentation.php b/application/src/Api/Representation/ItemRepresentation.php index f7c00669d0..73f2898b9f 100644 --- a/application/src/Api/Representation/ItemRepresentation.php +++ b/application/src/Api/Representation/ItemRepresentation.php @@ -76,6 +76,9 @@ public function sites() return $sites; } + /** + * @return MediaRepresentation|null + */ public function primaryMedia() { // Return the first media if one exists. diff --git a/application/src/Api/Representation/SitePageBlockRepresentation.php b/application/src/Api/Representation/SitePageBlockRepresentation.php index f51cc20b7a..a6a2b449b9 100644 --- a/application/src/Api/Representation/SitePageBlockRepresentation.php +++ b/application/src/Api/Representation/SitePageBlockRepresentation.php @@ -42,7 +42,7 @@ public function id() } /** - * @return SiteRepresentation + * @return SitePageRepresentation */ public function page() { diff --git a/application/src/Api/Representation/ValueRepresentation.php b/application/src/Api/Representation/ValueRepresentation.php index 7a8e18881d..7d5cab060c 100644 --- a/application/src/Api/Representation/ValueRepresentation.php +++ b/application/src/Api/Representation/ValueRepresentation.php @@ -148,7 +148,7 @@ public function uri() * * This is the object of the RDF triple represented by this value. * - * @return null|AbstractResourceEntityRepresentation + * @return AbstractResourceEntityRepresentation|null */ public function valueResource() { diff --git a/application/src/Controller/Admin/ItemController.php b/application/src/Controller/Admin/ItemController.php index 5311979665..4310e83486 100644 --- a/application/src/Controller/Admin/ItemController.php +++ b/application/src/Controller/Admin/ItemController.php @@ -2,8 +2,8 @@ namespace Omeka\Controller\Admin; use Omeka\Form\ConfirmForm; -use Omeka\Form\ResourceForm; use Omeka\Form\ResourceBatchUpdateForm; +use Omeka\Form\ResourceForm; use Omeka\Media\Ingester\Manager; use Omeka\Stdlib\Message; use Laminas\Mvc\Controller\AbstractActionController; diff --git a/application/src/Controller/Admin/UserController.php b/application/src/Controller/Admin/UserController.php index abe4273dcf..8200ed294f 100644 --- a/application/src/Controller/Admin/UserController.php +++ b/application/src/Controller/Admin/UserController.php @@ -186,9 +186,11 @@ public function editAction() } $this->messenger()->addSuccess('User successfully updated'); // @translate + $userSettings = $this->userSettings(); + $userSettings->setTargetId($id); if (!empty($values['user-settings'])) { foreach ($values['user-settings'] as $settingId => $settingValue) { - $this->userSettings()->set($settingId, $settingValue, $id); + $userSettings->set($settingId, $settingValue); } } diff --git a/application/src/Controller/ApiController.php b/application/src/Controller/ApiController.php index 9c13ed4a44..932c46f94e 100644 --- a/application/src/Controller/ApiController.php +++ b/application/src/Controller/ApiController.php @@ -29,6 +29,7 @@ class ApiController extends AbstractRestfulController /** * @param Paginator $paginator + * @param ApiManager $api */ public function __construct(Paginator $paginator, ApiManager $api) { diff --git a/application/src/Entity/ApiKey.php b/application/src/Entity/ApiKey.php index d5d98fa6bd..9925da611a 100644 --- a/application/src/Entity/ApiKey.php +++ b/application/src/Entity/ApiKey.php @@ -80,6 +80,7 @@ public function prePersist() public function setId() { $this->id = $this->getString(); + return $this; } public function getId() @@ -90,6 +91,7 @@ public function getId() public function setLabel($label) { $this->label = $label; + return $this; } public function getLabel() @@ -125,6 +127,7 @@ public function verifyCredential($credential) public function setLastIp($lastIp) { $this->lastIp = $lastIp; + return $this; } public function getLastIp() @@ -135,6 +138,7 @@ public function getLastIp() public function setLastAccessed(DateTime $lastAccessed) { $this->lastAccessed = $lastAccessed; + return $this; } public function getLastAccessed() @@ -145,6 +149,7 @@ public function getLastAccessed() public function setCreated(DateTime $created) { $this->created = $created; + return $this; } public function getCreated() @@ -155,6 +160,7 @@ public function getCreated() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() diff --git a/application/src/Entity/Asset.php b/application/src/Entity/Asset.php index 4d558ccb25..c92452a1e9 100644 --- a/application/src/Entity/Asset.php +++ b/application/src/Entity/Asset.php @@ -52,6 +52,7 @@ public function getId() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -62,6 +63,7 @@ public function getOwner() public function setName($name) { $this->name = $name; + return $this; } public function getName() @@ -72,6 +74,7 @@ public function getName() public function setMediaType($mediaType) { $this->mediaType = $mediaType; + return $this; } public function getMediaType() @@ -91,6 +94,7 @@ public function getFilename() public function setStorageId($storageId) { $this->storageId = $storageId; + return $this; } public function getStorageId() @@ -101,6 +105,7 @@ public function getStorageId() public function setExtension($extension) { $this->extension = $extension; + return $this; } public function getExtension() diff --git a/application/src/Entity/ItemSet.php b/application/src/Entity/ItemSet.php index 66e1ed1fc8..6c878fb811 100644 --- a/application/src/Entity/ItemSet.php +++ b/application/src/Entity/ItemSet.php @@ -50,6 +50,7 @@ public function getId() public function setIsOpen($isOpen) { $this->isOpen = (bool) $isOpen; + return $this; } public function isOpen() diff --git a/application/src/Entity/Job.php b/application/src/Entity/Job.php index fa5b006437..db8641cc79 100644 --- a/application/src/Entity/Job.php +++ b/application/src/Entity/Job.php @@ -84,6 +84,7 @@ public function getId() public function setPid($pid) { $this->pid = is_null($pid) ? null : trim($pid); + return $this; } public function getPid() @@ -94,6 +95,7 @@ public function getPid() public function setStatus($status) { $this->status = $status; + return $this; } public function getStatus() @@ -104,6 +106,7 @@ public function getStatus() public function setClass($class) { $this->class = trim($class); + return $this; } public function getClass() @@ -114,6 +117,7 @@ public function getClass() public function setArgs($args) { $this->args = $args; + return $this; } public function getArgs() @@ -124,6 +128,7 @@ public function getArgs() public function setLog($log) { $this->log = $log; + return $this; } public function addLog($log) @@ -139,6 +144,7 @@ public function getLog() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -149,6 +155,7 @@ public function getOwner() public function setStarted(DateTime $started) { $this->started = $started; + return $this; } public function getStarted() @@ -159,6 +166,7 @@ public function getStarted() public function setEnded(DateTime $ended) { $this->ended = $ended; + return $this; } public function getEnded() diff --git a/application/src/Entity/Media.php b/application/src/Entity/Media.php index 25ee390c6c..8572f5bd13 100644 --- a/application/src/Entity/Media.php +++ b/application/src/Entity/Media.php @@ -109,6 +109,7 @@ public function getId() public function setIngester($ingester) { $this->ingester = $ingester; + return $this; } public function getIngester() @@ -119,6 +120,7 @@ public function getIngester() public function setRenderer($renderer) { $this->renderer = $renderer; + return $this; } public function getRenderer() @@ -129,6 +131,7 @@ public function getRenderer() public function setData($data) { $this->data = $data; + return $this; } public function getData() @@ -139,6 +142,7 @@ public function getData() public function setSource($source) { $this->source = $source; + return $this; } public function getSource() @@ -149,6 +153,7 @@ public function getSource() public function setMediaType($mediaType) { $this->mediaType = $mediaType; + return $this; } public function getMediaType() @@ -159,6 +164,7 @@ public function getMediaType() public function setHasOriginal($hasOriginal) { $this->hasOriginal = (bool) $hasOriginal; + return $this; } public function hasOriginal() @@ -169,6 +175,7 @@ public function hasOriginal() public function setHasThumbnails($hasThumbnails) { $this->hasThumbnails = (bool) $hasThumbnails; + return $this; } public function hasThumbnails() @@ -179,6 +186,7 @@ public function hasThumbnails() public function setStorageId($storageId) { $this->storageId = $storageId; + return $this; } public function getStorageId() @@ -189,6 +197,7 @@ public function getStorageId() public function setExtension($extension) { $this->extension = $extension; + return $this; } public function getExtension() @@ -199,6 +208,7 @@ public function getExtension() public function setSha256($sha256) { $this->sha256 = $sha256; + return $this; } public function getSha256() @@ -209,6 +219,7 @@ public function getSha256() public function setSize($size) { $this->size = $size; + return $this; } public function getSize() @@ -228,6 +239,7 @@ public function getFilename() public function setPosition($position) { $this->position = $position; + return $this; } public function getPosition() @@ -238,6 +250,7 @@ public function getPosition() public function setItem(Item $item = null) { $this->item = $item; + return $this; } public function getItem() @@ -248,6 +261,7 @@ public function getItem() public function setLang($lang) { $this->lang = $lang; + return $this; } public function getLang() diff --git a/application/src/Entity/Migration.php b/application/src/Entity/Migration.php index 411b629608..fdd43d6f20 100644 --- a/application/src/Entity/Migration.php +++ b/application/src/Entity/Migration.php @@ -25,5 +25,6 @@ public function getVersion() public function setVersion($version) { $this->version = $version; + return $this; } } diff --git a/application/src/Entity/Module.php b/application/src/Entity/Module.php index 3cd46b4c21..e1cbac5d73 100644 --- a/application/src/Entity/Module.php +++ b/application/src/Entity/Module.php @@ -25,6 +25,7 @@ class Module extends AbstractEntity public function setId($id) { $this->id = $id; + return $this; } public function getId() @@ -35,6 +36,7 @@ public function getId() public function setIsActive($isActive) { $this->isActive = (bool) $isActive; + return $this; } public function isActive() @@ -45,6 +47,7 @@ public function isActive() public function setVersion($version) { $this->version = $version; + return $this; } public function getVersion() diff --git a/application/src/Entity/PasswordCreation.php b/application/src/Entity/PasswordCreation.php index ab148ef034..7e056d4fc4 100644 --- a/application/src/Entity/PasswordCreation.php +++ b/application/src/Entity/PasswordCreation.php @@ -41,6 +41,7 @@ public function setId() $apiKey = new ApiKey; $apiKey->setId(); $this->id = $apiKey->getId(); + return $this; } public function getId() @@ -51,6 +52,7 @@ public function getId() public function setUser(User $user) { $this->user = $user; + return $this; } public function getUser() @@ -66,6 +68,7 @@ public function getCreated() public function setActivate($activate) { $this->activate = (bool) $activate; + return $this; } public function activate() diff --git a/application/src/Entity/Property.php b/application/src/Entity/Property.php index c357bbb264..6fe024c8e4 100644 --- a/application/src/Entity/Property.php +++ b/application/src/Entity/Property.php @@ -75,6 +75,7 @@ public function getId() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -95,6 +96,7 @@ public function getVocabulary() public function setLocalName($localName) { $this->localName = $localName; + return $this; } public function getLocalName() @@ -105,6 +107,7 @@ public function getLocalName() public function setLabel($label) { $this->label = $label; + return $this; } public function getLabel() @@ -115,6 +118,7 @@ public function getLabel() public function setComment($comment) { $this->comment = $comment; + return $this; } public function getComment() diff --git a/application/src/Entity/Resource.php b/application/src/Entity/Resource.php index ba7ea08143..c4d3c87473 100644 --- a/application/src/Entity/Resource.php +++ b/application/src/Entity/Resource.php @@ -103,6 +103,7 @@ public function getId() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -113,6 +114,7 @@ public function getOwner() public function setResourceClass(ResourceClass $resourceClass = null) { $this->resourceClass = $resourceClass; + return $this; } public function getResourceClass() @@ -123,6 +125,7 @@ public function getResourceClass() public function setResourceTemplate(ResourceTemplate $resourceTemplate = null) { $this->resourceTemplate = $resourceTemplate; + return $this; } public function getResourceTemplate() @@ -133,6 +136,7 @@ public function getResourceTemplate() public function setThumbnail(Asset $thumbnail = null) { $this->thumbnail = $thumbnail; + return $this; } public function getThumbnail() @@ -156,6 +160,7 @@ public function getTitle() public function setIsPublic($isPublic) { $this->isPublic = (bool) $isPublic; + return $this; } public function isPublic() @@ -166,6 +171,7 @@ public function isPublic() public function setCreated(DateTime $dateTime) { $this->created = $dateTime; + return $this; } public function getCreated() @@ -176,6 +182,7 @@ public function getCreated() public function setModified(DateTime $dateTime) { $this->modified = $dateTime; + return $this; } public function getModified() diff --git a/application/src/Entity/ResourceClass.php b/application/src/Entity/ResourceClass.php index bf022cf16e..368b1d94e9 100644 --- a/application/src/Entity/ResourceClass.php +++ b/application/src/Entity/ResourceClass.php @@ -69,6 +69,7 @@ public function getId() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -79,6 +80,7 @@ public function getOwner() public function setVocabulary(Vocabulary $vocabulary = null) { $this->vocabulary = $vocabulary; + return $this; } public function getVocabulary() @@ -89,6 +91,7 @@ public function getVocabulary() public function setLocalName($localName) { $this->localName = $localName; + return $this; } public function getLocalName() @@ -99,6 +102,7 @@ public function getLocalName() public function setLabel($label) { $this->label = $label; + return $this; } public function getLabel() @@ -109,6 +113,7 @@ public function getLabel() public function setComment($comment) { $this->comment = $comment; + return $this; } public function getComment() diff --git a/application/src/Entity/ResourceTemplate.php b/application/src/Entity/ResourceTemplate.php index 12a126ae6c..6d2f300b05 100644 --- a/application/src/Entity/ResourceTemplate.php +++ b/application/src/Entity/ResourceTemplate.php @@ -78,6 +78,7 @@ public function getId() public function setLabel($label) { $this->label = $label; + return $this; } public function getLabel() @@ -88,6 +89,7 @@ public function getLabel() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -98,6 +100,7 @@ public function getOwner() public function setResourceClass(ResourceClass $resourceClass = null) { $this->resourceClass = $resourceClass; + return $this; } public function getResourceClass() diff --git a/application/src/Entity/ResourceTemplateProperty.php b/application/src/Entity/ResourceTemplateProperty.php index 3199bea68c..41b14b9cfd 100644 --- a/application/src/Entity/ResourceTemplateProperty.php +++ b/application/src/Entity/ResourceTemplateProperty.php @@ -70,6 +70,7 @@ public function getId() public function setResourceTemplate(ResourceTemplate $resourceTemplate = null) { $this->resourceTemplate = $resourceTemplate; + return $this; } public function getResourceTemplate() @@ -80,6 +81,7 @@ public function getResourceTemplate() public function setProperty(Property $property) { $this->property = $property; + return $this; } public function getProperty() @@ -90,6 +92,7 @@ public function getProperty() public function setAlternateLabel($alternateLabel) { $this->alternateLabel = $alternateLabel; + return $this; } public function getAlternateLabel() @@ -100,6 +103,7 @@ public function getAlternateLabel() public function setAlternateComment($alternateComment) { $this->alternateComment = $alternateComment; + return $this; } public function getAlternateComment() @@ -115,11 +119,13 @@ public function getPosition() public function setPosition($position) { $this->position = (int) $position; + return $this; } public function setDataType(array $dataType = null) { $this->dataType = $dataType; + return $this; } public function getDataType() @@ -130,6 +136,7 @@ public function getDataType() public function setIsRequired($isRequired) { $this->isRequired = (bool) $isRequired; + return $this; } public function getIsRequired() @@ -145,6 +152,7 @@ public function isRequired() public function setIsPrivate($isPrivate) { $this->isPrivate = (bool) $isPrivate; + return $this; } public function getIsPrivate() diff --git a/application/src/Entity/Setting.php b/application/src/Entity/Setting.php index f4657957ef..2342a55716 100644 --- a/application/src/Entity/Setting.php +++ b/application/src/Entity/Setting.php @@ -20,6 +20,7 @@ class Setting extends AbstractEntity public function setId($id) { $this->id = $id; + return $this; } public function getId() @@ -30,6 +31,7 @@ public function getId() public function setValue($value) { $this->value = $value; + return $this; } public function getValue() diff --git a/application/src/Entity/Site.php b/application/src/Entity/Site.php index 476663a6bd..bc0896f4dd 100644 --- a/application/src/Entity/Site.php +++ b/application/src/Entity/Site.php @@ -139,6 +139,7 @@ public function getId() public function setSlug($slug) { $this->slug = $slug; + return $this; } public function getSlug() @@ -149,6 +150,7 @@ public function getSlug() public function setTheme($theme) { $this->theme = $theme; + return $this; } public function getTheme() @@ -159,6 +161,7 @@ public function getTheme() public function setTitle($title) { $this->title = $title; + return $this; } public function getTitle() @@ -169,6 +172,7 @@ public function getTitle() public function setSummary($summary) { $this->summary = $summary; + return $this; } public function getSummary() @@ -189,6 +193,7 @@ public function getThumbnail() public function setNavigation($navigation) { $this->navigation = $navigation; + return $this; } public function getNavigation() @@ -209,6 +214,7 @@ public function getHomepage() public function setItemPool($itemPool) { $this->itemPool = $itemPool; + return $this; } public function getItemPool() @@ -219,6 +225,7 @@ public function getItemPool() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -229,6 +236,7 @@ public function getOwner() public function setCreated(DateTime $dateTime) { $this->created = $dateTime; + return $this; } public function getCreated() @@ -239,6 +247,7 @@ public function getCreated() public function setModified(DateTime $dateTime) { $this->modified = $dateTime; + return $this; } public function getModified() @@ -249,6 +258,7 @@ public function getModified() public function setIsPublic($isPublic) { $this->isPublic = (bool) $isPublic; + return $this; } public function isPublic() diff --git a/application/src/Entity/SiteBlockAttachment.php b/application/src/Entity/SiteBlockAttachment.php index e4735339cb..d8d477c10c 100644 --- a/application/src/Entity/SiteBlockAttachment.php +++ b/application/src/Entity/SiteBlockAttachment.php @@ -57,6 +57,7 @@ public function getId() public function setCaption($caption) { $this->caption = $caption; + return $this; } public function getCaption() @@ -67,6 +68,7 @@ public function getCaption() public function setPosition($position) { $this->position = $position; + return $this; } public function getPosition() @@ -77,6 +79,7 @@ public function getPosition() public function setItem(Item $item = null) { $this->item = $item; + return $this; } public function getItem() @@ -87,6 +90,7 @@ public function getItem() public function setMedia(Media $media = null) { $this->media = $media; + return $this; } public function getMedia() @@ -97,6 +101,7 @@ public function getMedia() public function setBlock(SitePageBlock $block) { $this->block = $block; + return $this; } public function getBlock() diff --git a/application/src/Entity/SiteItemSet.php b/application/src/Entity/SiteItemSet.php index e9d8524297..34e898dfec 100644 --- a/application/src/Entity/SiteItemSet.php +++ b/application/src/Entity/SiteItemSet.php @@ -51,6 +51,7 @@ public function getId() public function setSite(Site $site) { $this->site = $site; + return $this; } public function getSite() @@ -61,6 +62,7 @@ public function getSite() public function setItemSet(ItemSet $itemSet) { $this->itemSet = $itemSet; + return $this; } public function getItemSet() @@ -71,6 +73,7 @@ public function getItemSet() public function setPosition($position) { $this->position = (int) $position; + return $this; } public function getPosition() diff --git a/application/src/Entity/SitePage.php b/application/src/Entity/SitePage.php index c2dcf64dec..51ccacfc97 100644 --- a/application/src/Entity/SitePage.php +++ b/application/src/Entity/SitePage.php @@ -78,6 +78,7 @@ public function getId() public function setSlug($slug) { $this->slug = $slug; + return $this; } public function getSlug() @@ -88,6 +89,7 @@ public function getSlug() public function setTitle($title) { $this->title = $title; + return $this; } public function getTitle() @@ -108,6 +110,7 @@ public function isPublic() public function setSite(Site $site) { $this->site = $site; + return $this; } public function getSite() @@ -118,6 +121,7 @@ public function getSite() public function setCreated(DateTime $dateTime) { $this->created = $dateTime; + return $this; } public function getCreated() @@ -128,6 +132,7 @@ public function getCreated() public function setModified(DateTime $dateTime) { $this->modified = $dateTime; + return $this; } public function getModified() diff --git a/application/src/Entity/SitePageBlock.php b/application/src/Entity/SitePageBlock.php index f039f82a9c..02873e43f6 100644 --- a/application/src/Entity/SitePageBlock.php +++ b/application/src/Entity/SitePageBlock.php @@ -68,6 +68,7 @@ public function getId() public function setLayout($layout) { $this->layout = $layout; + return $this; } public function getLayout() @@ -78,6 +79,7 @@ public function getLayout() public function setData($data) { $this->data = $data; + return $this; } public function getData() @@ -88,6 +90,7 @@ public function getData() public function setPosition($position) { $this->position = $position; + return $this; } public function getPosition() @@ -98,6 +101,7 @@ public function getPosition() public function setPage(SitePage $page) { $this->page = $page; + return $this; } public function getPage() diff --git a/application/src/Entity/SitePermission.php b/application/src/Entity/SitePermission.php index 393aeae452..e71db8620d 100644 --- a/application/src/Entity/SitePermission.php +++ b/application/src/Entity/SitePermission.php @@ -49,6 +49,7 @@ public function getId() public function setSite(Site $site) { $this->site = $site; + return $this; } public function getSite() @@ -59,6 +60,7 @@ public function getSite() public function setUser(User $user) { $this->user = $user; + return $this; } public function getUser() @@ -69,6 +71,7 @@ public function getUser() public function setRole($role) { $this->role = $role; + return $this; } public function getRole() diff --git a/application/src/Entity/SiteSetting.php b/application/src/Entity/SiteSetting.php index 0094891688..cf5191923f 100644 --- a/application/src/Entity/SiteSetting.php +++ b/application/src/Entity/SiteSetting.php @@ -27,6 +27,7 @@ class SiteSetting extends AbstractEntity public function setId($id) { $this->id = $id; + return $this; } public function getId() @@ -37,6 +38,7 @@ public function getId() public function setSite(Site $site) { $this->site = $site; + return $this; } public function getSite() @@ -47,6 +49,7 @@ public function getSite() public function setValue($value) { $this->value = $value; + return $this; } public function getValue() diff --git a/application/src/Entity/User.php b/application/src/Entity/User.php index f48065b4a2..41bd531ef6 100644 --- a/application/src/Entity/User.php +++ b/application/src/Entity/User.php @@ -109,6 +109,7 @@ public function getId() public function setName($name) { $this->name = $name; + return $this; } public function getName() @@ -119,6 +120,7 @@ public function getName() public function setEmail($email) { $this->email = $email; + return $this; } public function getEmail() @@ -134,11 +136,13 @@ public function getCreated() public function setCreated(DateTime $created) { $this->created = $created; + return $this; } public function setModified(DateTime $dateTime) { $this->modified = $dateTime; + return $this; } public function getModified() @@ -154,6 +158,7 @@ public function getModified() public function setPassword($password) { $this->passwordHash = password_hash($password, PASSWORD_DEFAULT); + return $this; } /** @@ -175,6 +180,7 @@ public function verifyPassword($possiblePassword) public function setRole($role) { $this->role = $role; + return $this; } public function getRole() @@ -185,6 +191,7 @@ public function getRole() public function setIsActive($isActive) { $this->isActive = (bool) $isActive; + return $this; } public function isActive() diff --git a/application/src/Entity/UserSetting.php b/application/src/Entity/UserSetting.php index 9f8e0b411f..24270645fd 100644 --- a/application/src/Entity/UserSetting.php +++ b/application/src/Entity/UserSetting.php @@ -27,6 +27,7 @@ class UserSetting extends AbstractEntity public function setId($id) { $this->id = $id; + return $this; } public function getId() @@ -37,6 +38,7 @@ public function getId() public function setUser(User $user) { $this->user = $user; + return $this; } public function getUser() @@ -47,6 +49,7 @@ public function getUser() public function setValue($value) { $this->value = $value; + return $this; } public function getValue() diff --git a/application/src/Entity/Value.php b/application/src/Entity/Value.php index abb1562981..7634e94f79 100644 --- a/application/src/Entity/Value.php +++ b/application/src/Entity/Value.php @@ -70,6 +70,7 @@ public function getId() public function setResource(Resource $resource = null) { $this->resource = $resource; + return $this; } public function getResource() @@ -80,6 +81,7 @@ public function getResource() public function setProperty(Property $property) { $this->property = $property; + return $this; } public function getProperty() @@ -90,6 +92,7 @@ public function getProperty() public function setType($type) { $this->type = $type; + return $this; } public function getType() @@ -100,6 +103,7 @@ public function getType() public function setValue($value) { $this->value = $value; + return $this; } public function getValue() @@ -110,6 +114,7 @@ public function getValue() public function setLang($lang) { $this->lang = $lang; + return $this; } public function getLang() @@ -120,6 +125,7 @@ public function getLang() public function setUri($uri) { $this->uri = $uri; + return $this; } public function getUri() @@ -130,6 +136,7 @@ public function getUri() public function setValueResource(Resource $valueResource = null) { $this->valueResource = $valueResource; + return $this; } public function getValueResource() @@ -140,6 +147,7 @@ public function getValueResource() public function setIsPublic($isPublic) { $this->isPublic = (bool) $isPublic; + return $this; } public function getIsPublic() diff --git a/application/src/Entity/Vocabulary.php b/application/src/Entity/Vocabulary.php index e0aaaaf77d..2c8874f0cf 100644 --- a/application/src/Entity/Vocabulary.php +++ b/application/src/Entity/Vocabulary.php @@ -81,6 +81,7 @@ public function getId() public function setOwner(User $owner = null) { $this->owner = $owner; + return $this; } public function getOwner() @@ -91,6 +92,7 @@ public function getOwner() public function setNamespaceUri($namespaceUri) { $this->namespaceUri = $namespaceUri; + return $this; } public function getNamespaceUri() @@ -101,6 +103,7 @@ public function getNamespaceUri() public function setPrefix($prefix) { $this->prefix = $prefix; + return $this; } public function getPrefix() @@ -111,6 +114,7 @@ public function getPrefix() public function setLabel($label) { $this->label = $label; + return $this; } public function getLabel() @@ -121,6 +125,7 @@ public function getLabel() public function setComment($comment) { $this->comment = $comment; + return $this; } public function getComment() diff --git a/application/src/Form/Element/AbstractGroupByOwnerSelect.php b/application/src/Form/Element/AbstractGroupByOwnerSelect.php index d17768ac98..10d93cb1c9 100644 --- a/application/src/Form/Element/AbstractGroupByOwnerSelect.php +++ b/application/src/Form/Element/AbstractGroupByOwnerSelect.php @@ -89,7 +89,7 @@ public function getValueOptions() if ($owner instanceof UserRepresentation) { $label = sprintf('%s (%s)', $owner->name(), $owner->email()); } else { - $label = '[No owner]'; + $label = '[No owner]'; // @translate } $valueOptions[] = ['label' => $label, 'options' => $options]; } diff --git a/application/src/Form/ResourceTemplateForm.php b/application/src/Form/ResourceTemplateForm.php index f7ef19c13e..095b8d480e 100644 --- a/application/src/Form/ResourceTemplateForm.php +++ b/application/src/Form/ResourceTemplateForm.php @@ -29,7 +29,7 @@ public function init() ], 'attributes' => [ 'class' => 'chosen-select', - 'data-placeholder' => 'Select a class', + 'data-placeholder' => 'Select a class', // @translate 'id' => 'o:resource_class[o:id]', ], ]); diff --git a/application/src/Form/SettingForm.php b/application/src/Form/SettingForm.php index 011826fd68..a2b127f0f6 100644 --- a/application/src/Form/SettingForm.php +++ b/application/src/Form/SettingForm.php @@ -453,7 +453,7 @@ public function init() ], ]); - // Separate events because calling getInputFilters() resets everything. + // Separate events because calling getInputFilter() resets everything. $event = new Event('form.add_input_filters', $this, ['inputFilter' => $inputFilter]); $this->getEventManager()->triggerEvent($event); } diff --git a/application/src/Form/SitePageForm.php b/application/src/Form/SitePageForm.php index 757e1adbf0..496e7222e9 100644 --- a/application/src/Form/SitePageForm.php +++ b/application/src/Form/SitePageForm.php @@ -1,6 +1,7 @@ add([ 'name' => 'o:title', - 'type' => 'Text', + 'type' => Element\Text::class, 'options' => [ 'label' => 'Title', // @translate ], @@ -20,9 +21,10 @@ public function init() 'required' => true, ], ]); + $this->add([ 'name' => 'o:slug', - 'type' => 'Text', + 'type' => Element\Text::class, 'options' => [ 'label' => 'URL slug', // @translate ], diff --git a/application/src/Installation/Task/InstallDefaultTemplatesTask.php b/application/src/Installation/Task/InstallDefaultTemplatesTask.php index 193674e9df..76c75650b8 100644 --- a/application/src/Installation/Task/InstallDefaultTemplatesTask.php +++ b/application/src/Installation/Task/InstallDefaultTemplatesTask.php @@ -74,7 +74,7 @@ public function perform(Installer $installer) * Install a default resource template. * * @param string $label A label of a template defined in this class - * @return null|false Returns false if the label does not exist + * @return false|null Returns false if the label does not exist */ public function installTemplate($label) { diff --git a/application/src/Job/Dispatcher.php b/application/src/Job/Dispatcher.php index a6cb2aa648..247e0caef3 100644 --- a/application/src/Job/Dispatcher.php +++ b/application/src/Job/Dispatcher.php @@ -65,7 +65,7 @@ public function getDispatchStrategy() * @param string $class * @param mixed $args * @param StrategyInterface $strategy - * @return null|Job $job + * @return Job|null $job */ public function dispatch($class, $args = null, StrategyInterface $strategy = null) { diff --git a/application/src/Media/Ingester/IIIF.php b/application/src/Media/Ingester/IIIF.php index 19fd459c18..f6fd129489 100644 --- a/application/src/Media/Ingester/IIIF.php +++ b/application/src/Media/Ingester/IIIF.php @@ -42,14 +42,14 @@ public function ingest(Media $media, Request $request, ErrorStore $errorStore) { $data = $request->getContent(); if (!isset($data['o:source'])) { - $errorStore->addError('o:source', 'No IIIF image URL specified'); + $errorStore->addError('o:source', 'No IIIF image URL specified'); // @translate return; } $source = $data['o:source']; //Make a request and handle any errors that might occur. $uri = new HttpUri($source); if (!($uri->isValid() && $uri->isAbsolute())) { - $errorStore->addError('o:source', "Invalid URL specified"); + $errorStore->addError('o:source', 'Invalid URL specified'); // @translate return false; } $client = $this->httpClient; @@ -58,7 +58,7 @@ public function ingest(Media $media, Request $request, ErrorStore $errorStore) $response = $client->send(); if (!$response->isOk()) { $errorStore->addError('o:source', sprintf( - "Error reading %s: %s (%s)", + "Error reading %s: %s (%s)", // @translate $this->getLabel(), $response->getReasonPhrase(), $response->getStatusCode() @@ -67,14 +67,14 @@ public function ingest(Media $media, Request $request, ErrorStore $errorStore) } $IIIFData = json_decode($response->getBody(), true); if (!$IIIFData) { - $errorStore->addError('o:source', 'Error decoding IIIF JSON'); + $errorStore->addError('o:source', 'Error decoding IIIF JSON'); // @translate return; } //Check if valid IIIF data if ($this->validate($IIIFData)) { $media->setData($IIIFData); } else { - $errorStore->addError('o:source', 'URL does not link to IIIF JSON'); + $errorStore->addError('o:source', 'URL does not link to IIIF JSON'); // @translate return; } diff --git a/application/src/Mvc/Controller/Plugin/Api.php b/application/src/Mvc/Controller/Plugin/Api.php index 4f6634223d..4a3746ecbd 100644 --- a/application/src/Mvc/Controller/Plugin/Api.php +++ b/application/src/Mvc/Controller/Plugin/Api.php @@ -56,6 +56,7 @@ public function __invoke(Form $form = null, $throwValidationException = false) * * @param string $resource * @param array $data + * @param array $options * @return Response */ public function search($resource, $data = [], array $options = []) @@ -74,7 +75,7 @@ public function search($resource, $data = [], array $options = []) * @param array $options * @return Response */ - public function searchOne($resource, $data = [], array $options = []) + public function searchOne($resource, array $data = [], array $options = []) { $data['limit'] = 1; $response = $this->search($resource, $data, $options); diff --git a/application/src/Mvc/Status.php b/application/src/Mvc/Status.php index a870367e3e..91548bd5fe 100644 --- a/application/src/Mvc/Status.php +++ b/application/src/Mvc/Status.php @@ -64,7 +64,7 @@ public function setIsInstalled($isInstalled) /** * Get the route match. * - * @return Laminas\Router\Http\RouteMatch + * @return \Laminas\Router\Http\RouteMatch */ public function getRouteMatch() { diff --git a/application/src/Service/AclFactory.php b/application/src/Service/AclFactory.php index 70f32b4656..447ed9c19e 100644 --- a/application/src/Service/AclFactory.php +++ b/application/src/Service/AclFactory.php @@ -103,7 +103,7 @@ protected function addResources(Acl $acl, ContainerInterface $serviceLocator) $entities = $serviceLocator->get('Omeka\EntityManager')->getConfiguration() ->getMetadataDriverImpl()->getAllClassNames(); foreach ($entities as $entityClass) { - if (is_subclass_of($entityClass, 'Laminas\Permissions\Acl\Resource\ResourceInterface')) { + if (is_subclass_of($entityClass, \Laminas\Permissions\Acl\Resource\ResourceInterface::class)) { $acl->addResource($entityClass); } } diff --git a/application/src/Service/ModuleManagerFactory.php b/application/src/Service/ModuleManagerFactory.php index 6f49f3b841..b5ac19c736 100644 --- a/application/src/Service/ModuleManagerFactory.php +++ b/application/src/Service/ModuleManagerFactory.php @@ -137,7 +137,7 @@ public function __invoke(ContainerInterface $serviceLocator, $requestedName, arr $module->setState(ModuleManager::STATE_ACTIVE); } - foreach ($manager->getModules() as $id => $module) { + foreach ($manager->getModules() as $module) { if (!$module->getState()) { // Module in filesystem but not installed $module->setState(ModuleManager::STATE_NOT_INSTALLED); diff --git a/application/src/Service/ViewHelper/StatusFactory.php b/application/src/Service/ViewHelper/StatusFactory.php index 03f3add695..bb04dbf0cb 100644 --- a/application/src/Service/ViewHelper/StatusFactory.php +++ b/application/src/Service/ViewHelper/StatusFactory.php @@ -13,7 +13,7 @@ class StatusFactory implements FactoryInterface /** * Create and return the status view helper * - * @return Setting + * @return Status */ public function __invoke(ContainerInterface $services, $requestedName, array $options = null) { diff --git a/application/src/ServiceManager/AbstractPluginManager.php b/application/src/ServiceManager/AbstractPluginManager.php index d138445bfd..7d76f743b4 100644 --- a/application/src/ServiceManager/AbstractPluginManager.php +++ b/application/src/ServiceManager/AbstractPluginManager.php @@ -65,7 +65,7 @@ public function configure(array $config) * * An alternative to parent::getCanonicalNames(). Returns only the names * that are registered in configuration as invokable classes and factories. - * The list many be modified during the service.registered_names event. + * The list may be modified during the service.registered_names event. * * @param bool $sortAlpha * @return array diff --git a/application/src/Site/BlockLayout/BrowsePreview.php b/application/src/Site/BlockLayout/BrowsePreview.php index 5384629ad6..c90d3b0c79 100644 --- a/application/src/Site/BlockLayout/BrowsePreview.php +++ b/application/src/Site/BlockLayout/BrowsePreview.php @@ -108,7 +108,7 @@ public function form(PhpRenderer $view, SiteRepresentation $site, 'type' => Element\Text::class, 'options' => [ 'label' => 'Link text', // @translate - 'info' => 'Text for link to full browse view, if any.', // @translate + 'info' => 'Text for link to full browse view, if any. There is no link for media.', // @translate ], ]); @@ -162,6 +162,8 @@ public function render(PhpRenderer $view, SitePageBlockRepresentation $block) 'media' => 'media', ]; + // There is no list of media in public views. + $linkText = $resourceType === 'media' ? '' : $block->dataValue('link-text'); return $view->partial('common/block-layout/browse-preview', [ 'resourceType' => $resourceTypes[$resourceType], 'resources' => $resources, diff --git a/application/view/omeka/admin/item-set/search.phtml b/application/view/omeka/admin/item-set/search.phtml index ffb46656ee..47b0190e31 100644 --- a/application/view/omeka/admin/item-set/search.phtml +++ b/application/view/omeka/admin/item-set/search.phtml @@ -6,7 +6,7 @@ $this->htmlElement('body')->appendAttribute('class', 'item-sets search');