diff --git a/.travis.yml b/.travis.yml
index 2c31704e..f087d015 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,17 +4,17 @@ language: php
matrix:
include:
- #5.3.3 Ubuntu Precise exceptions
- - php: 5.3.3
+ #5.3 Ubuntu Precise exceptions
+ - php: 5.3
dist: precise
env: FEDORA_VERSION="3.5"
- - php: 5.3.3
+ - php: 5.3
dist: precise
env: FEDORA_VERSION="3.6.2"
- - php: 5.3.3
+ - php: 5.3
dist: precise
env: FEDORA_VERSION="3.7.0"
- - php: 5.3.3
+ - php: 5.3
dist: precise
env: FEDORA_VERSION="3.8.1"
php:
@@ -38,7 +38,9 @@ branches:
- secure: "nTv2Zb/qKlECK+xE5ahbfXI9ZZbf2ZMd796q7oPlTxUwvu6nomHnUOjJATl6tq2cj23PyJ89Jlgl5cMZ5h0QMUzYpN5hPyY6oCJxWgFamFaE3bv5E/rBd1f6WVTJW7S4UKn8Mr9R2PrX+ZxQZGVIigAfR8VfhQuP8PcuO5eMLBk="
before_install:
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR
+ - export TOOLS_DIR=$HOME/tools/
- $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh
+ - $TRAVIS_BUILD_DIR/tests/scripts/phpcs_setup.sh
- cd $HOME/drupal-*
before_script:
# Mysql might time out for long tests, increase the wait timeout.
@@ -47,7 +49,7 @@ before_script:
script:
- ant -buildfile sites/all/modules/islandora/build.xml lint
- $ISLANDORA_DIR/tests/scripts/line_endings.sh sites/all/modules/islandora
- - drush coder-review --reviews=production,security,style,i18n,potx,sniffer islandora
+ - $TOOLS_DIR/vendor/bin/phpcs --standard=drupal,drupalpractice --ignore=vendor,*.md,*.info,*.txt sites/all/modules/islandora
- phpcpd --names *.module,*.inc,*.test sites/all/modules/islandora
- php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose "Islandora"
after_failure:
diff --git a/css/islandora.admin.css b/css/islandora.admin.css
index c7e51b28..0389150b 100644
--- a/css/islandora.admin.css
+++ b/css/islandora.admin.css
@@ -5,19 +5,16 @@
/* Solution pack admin page */
-.islandora-solution-pack-fieldset
-{
+.islandora-solution-pack-fieldset {
padding-top: 0.5em;
}
.islandora-solution-pack-fieldset table th,
-.islandora-solution-pack-fieldset table td
-{
+.islandora-solution-pack-fieldset table td {
width: 30%;
}
.islandora-solution-pack-fieldset table th:first-child,
-.islandora-solution-pack-fieldset table td:first-child
-{
+.islandora-solution-pack-fieldset table td:first-child {
width: 10%;
-}
\ No newline at end of file
+}
diff --git a/css/islandora.base.css b/css/islandora.base.css
index 28301aa1..9ecd8d9a 100644
--- a/css/islandora.base.css
+++ b/css/islandora.base.css
@@ -26,7 +26,7 @@
dl.islandora-inline-metadata {
margin: 0 auto;
letter-spacing: -0.31em;
- *letter-spacing:normal;
+ *letter-spacing: normal;
word-spacing: -0.43em;
}
@@ -44,17 +44,17 @@ dl.islandora-inline-metadata {
}
dl.islandora-metadata-fields {
- width:100%;
+ width: 100%;
}
.islandora-metadata dt,
.islandora-metadata dd {
- border-top:1px solid #e5e5e5;
+ border-top: 1px solid #e5e5e5;
}
.islandora-metadata dt.first,
.islandora-metadata dd.first {
- border-top:0;
+ border-top: 0;
}
/*
* In this rule, we reset the white-space (see hack above)
diff --git a/css/islandora.print.css b/css/islandora.print.css
index 4b714bc5..3bf1d357 100644
--- a/css/islandora.print.css
+++ b/css/islandora.print.css
@@ -5,21 +5,11 @@
* We provide some sane print styling for Drupal, hiding most visuals.
*/
-#content a[href^="javascript:"]:after,
-#content a[href^="#"]:after { /* Only display useful links. */
-/* content: ""; */
-}
-
-#content abbr[title]:after { /* Add visible title after abbreviations. */
-/* content: " (" attr(title) ")"; */
-}
-
#content {
- left: 0 !important;
- width: 100% !important;
+ left: 0 !important;
+ width: 100% !important;
}
-uncomment when ready to test printing
-#header {
+uncomment when ready to test printing #header {
display: none !important;
}
@@ -40,8 +30,8 @@ body,
}
body.sidebar-first {
- left: 0 !important;
- width: 100% !important;
+ left: 0 !important;
+ width: 100% !important;
}
#skip-link,
#toolbar,
diff --git a/includes/add_datastream.form.inc b/includes/add_datastream.form.inc
index 3ad5a965..f7d5b18e 100644
--- a/includes/add_datastream.form.inc
+++ b/includes/add_datastream.form.inc
@@ -201,7 +201,7 @@ function islandora_add_datastream_form_submit(array $form, array &$form_state) {
file_delete($file);
}
catch (exception $e) {
- drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
+ drupal_set_message(t('@message', array('@message' => $e->getMessage())), 'error');
// Make sure to delete anyways.
file_delete($file);
return;
@@ -227,7 +227,7 @@ function islandora_add_datastream_form_autocomplete_callback(AbstractObject $obj
$dsids = array_combine($dsids, $dsids);
$query = trim($query);
if (!empty($query)) {
- $filter = function($id) use($query) {
+ $filter = function ($id) use ($query) {
return stripos($id, $query) !== FALSE;
};
$dsids = array_filter($dsids, $filter);
diff --git a/includes/admin.form.inc b/includes/admin.form.inc
index 4259c956..f72640de 100644
--- a/includes/admin.form.inc
+++ b/includes/admin.form.inc
@@ -48,7 +48,8 @@ function islandora_repository_admin(array $form, array &$form_state) {
'#title' => t('Fedora base URL'),
'#default_value' => variable_get('islandora_base_url', 'http://localhost:8080/fedora'),
'#description' => t('The URL to use for REST connections
!confirmation_message', array(
- '!confirmation_message' => $confirmation_message)),
+ '!confirmation_message' => $confirmation_message,
+ )),
'#required' => TRUE,
'#ajax' => array(
'callback' => 'islandora_update_url_div',
@@ -223,19 +224,23 @@ function islandora_admin_settings_form_repository_access_message($url) {
}
}
if ($info && $dc) {
- $confirmation_message = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
+ $confirmation_message = theme('image', array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
$confirmation_message .= t('Successfully connected to Fedora Server (Version !version).', array(
- '!version' => $info['repositoryVersion']));
+ '!version' => $info['repositoryVersion'],
+ ));
}
elseif ($info) {
- $confirmation_message = theme_image(array('path' => 'misc/watchdog-warning.png', 'attributes' => array()));
+ $confirmation_message = theme('image', array('path' => 'misc/watchdog-warning.png', 'attributes' => array()));
$confirmation_message .= t('Unable to authenticate when connecting to to Fedora Server (Version !version). Please configure the !filter.', array(
- '!version' => $info['repositoryVersion'], '!filter' => 'Drupal Filter'));
+ '!version' => $info['repositoryVersion'],
+ '!filter' => 'Drupal Filter',
+ ));
}
else {
- $confirmation_message = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
+ $confirmation_message = theme('image', array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
$confirmation_message .= t('Unable to connect to Fedora server at !islandora_url', array(
- '!islandora_url' => $url));
+ '!islandora_url' => $url,
+ ));
}
return $confirmation_message;
}
diff --git a/includes/authtokens.inc b/includes/authtokens.inc
index d5d98117..d8048734 100644
--- a/includes/authtokens.inc
+++ b/includes/authtokens.inc
@@ -37,7 +37,7 @@ function islandora_get_object_token($pid, $dsid, $uses = 1) {
global $user;
$time = time();
$token = bin2hex(drupal_random_bytes(32));
- $id = db_insert("islandora_authtokens")->fields(
+ db_insert("islandora_authtokens")->fields(
array(
'token' => $token,
'uid' => $user->uid,
@@ -104,11 +104,11 @@ function islandora_validate_object_token($pid, $dsid, $token) {
// Decrement authentication token uses.
else {
db_update("islandora_authtokens")
- ->fields(array('remaining_uses' => $remaining_uses))
- ->condition('token', $token, '=')
- ->condition('pid', $pid, '=')
- ->condition('dsid', $dsid, '=')
- ->execute();
+ ->fields(array('remaining_uses' => $remaining_uses))
+ ->condition('token', $token, '=')
+ ->condition('pid', $pid, '=')
+ ->condition('dsid', $dsid, '=')
+ ->execute();
}
unset($result[0]->remaining_uses);
$accounts[$pid][$dsid][$token] = $result[0];
diff --git a/includes/content_model.autocomplete.inc b/includes/content_model.autocomplete.inc
index 67923e9e..466cb71f 100644
--- a/includes/content_model.autocomplete.inc
+++ b/includes/content_model.autocomplete.inc
@@ -1,4 +1,5 @@
owner;
foreach ($audit_values as $audit_value) {
- $internal = $datastream_version->createdDate;
if ($audit_value['date'] == $datastream_version->createdDate) {
$reponsibility = $audit_value['responsibility'];
}
@@ -142,15 +141,17 @@ function islandora_delete_datastream_version_form_submit(array $form, array &$fo
}
catch (Exception $e) {
drupal_set_message(t('Error deleting version %v of %s datastream from object %o %e', array(
- '%v' => $version,
- '%s' => $datastream_id,
- '%o' => $object->label,
- '%e' => $e->getMessage())), 'error');
+ '%v' => $version,
+ '%s' => $datastream_id,
+ '%o' => $object->label,
+ '%e' => $e->getMessage(),
+ )), 'error');
}
drupal_set_message(t('%d datastream version successfully deleted from Islandora object %o', array(
- '%d' => $datastream_id,
- '%o' => $object->label)));
+ '%d' => $datastream_id,
+ '%o' => $object->label,
+ )));
$form_state['redirect'] = "islandora/object/{$object->id}/datastream/{$datastream->id}/version";
}
@@ -224,9 +225,10 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo
}
drupal_set_message(t('%d datastream successfully reverted to version %v for Islandora object %o', array(
- '%d' => $datastream_to_revert->id,
- '%v' => $version,
- '%o' => $islandora_object->label)));
+ '%d' => $datastream_to_revert->id,
+ '%v' => $version,
+ '%o' => $islandora_object->label,
+ )));
$form_state['redirect'] = "islandora/object/{$islandora_object->id}/datastream/{$datastream_to_revert->id}/version";
}
@@ -235,9 +237,9 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo
* Process available dsids, mime and extensions for a given object.
*
* @param AbstractObject $object
- * The FedoraObject to process available extensions
+ * The FedoraObject to process available extensions.
*
- * @return array()
+ * @return array
* An associative array, merged from calls to
* islandora_get_datastreams_requirements_from_content_models()
* and an objects dsid's.
@@ -272,7 +274,7 @@ function islandora_get_object_extensions(AbstractObject $object) {
* @return array
* The drupal form definition.
*/
-function islandora_datastream_version_replace_form($form, &$form_state, AbstractDatastream $datastream) {
+function islandora_datastream_version_replace_form(array $form, array &$form_state, AbstractDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/content_model');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/mimetype.utils');
@@ -330,7 +332,7 @@ function islandora_datastream_version_replace_form($form, &$form_state, Abstract
* @param array $form_state
* The Drupal form state.
*/
-function islandora_datastream_version_replace_form_submit($form, &$form_state) {
+function islandora_datastream_version_replace_form_submit(array $form, array &$form_state) {
$object = islandora_object_load($form_state['object_id']);
$form_state['redirect'] = "islandora/object/{$object->id}";
$file = file_load($form_state['values']['file']);
@@ -363,7 +365,7 @@ function islandora_datastream_version_replace_form_submit($form, &$form_state) {
* Gets Audit datastream values from foxml.
*
* @param string $pid
- * PID of parent object
+ * PID of parent object.
*
* @return array
* Array of audit values
diff --git a/includes/delete_datastream.form.inc b/includes/delete_datastream.form.inc
index 6d67c8dd..ad24eba7 100644
--- a/includes/delete_datastream.form.inc
+++ b/includes/delete_datastream.form.inc
@@ -127,19 +127,22 @@ function islandora_delete_datastream_form_submit(array $form, array &$form_state
}
catch (Exception $e) {
drupal_set_message(t('Error deleting %s datastream from object %o %e', array(
- '%s' => $datastream_id,
- '%o' => $object->label,
- '%e' => $e->getMessage())), 'error');
+ '%s' => $datastream_id,
+ '%o' => $object->label,
+ '%e' => $e->getMessage(),
+ )), 'error');
}
if ($deleted) {
drupal_set_message(t('%d datastream sucessfully deleted from Islandora object %o', array(
- '%d' => $datastream_id,
- '%o' => $object->label)));
+ '%d' => $datastream_id,
+ '%o' => $object->label,
+ )));
}
else {
drupal_set_message(t('Error deleting %s datastream from object %o', array(
- '%s' => $datastream_id,
- '%o' => $object->label)), 'error');
+ '%s' => $datastream_id,
+ '%o' => $object->label,
+ )), 'error');
}
$form_state['redirect'] = "islandora/object/{$object->id}";
}
diff --git a/includes/derivatives.inc b/includes/derivatives.inc
index 9b44b9af..2b71429a 100644
--- a/includes/derivatives.inc
+++ b/includes/derivatives.inc
@@ -1,4 +1,5 @@
array(),
'dc:creator' => array(),
@@ -30,7 +35,6 @@ class DublinCore {
'dc:coverage' => array(),
'dc:rights' => array(),
);
- public $owner;
/**
* Constructor.
@@ -81,7 +85,7 @@ class DublinCore {
* @return string
* The serialized XML.
*/
- public function asXML() {
+ public function asXml() {
$dc_xml = new DomDocument();
$oai_dc = $dc_xml->createElementNS('http://www.openarchives.org/OAI/2.0/oai_dc/', 'oai_dc:dc');
$oai_dc->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
@@ -152,7 +156,8 @@ class DublinCore {
* @return DublinCore
* The instantiated object.
*/
- public static function importFromXMLString($dc_xml) {
+ // @codingStandardsIgnoreLine
+ public static function importFromXmlString($dc_xml) {
$dc_doc = new DomDocument();
if (!empty($dc_xml) && $dc_doc->loadXML($dc_xml)) {
$oai_dc = $dc_doc->getElementsByTagNameNS('http://purl.org/dc/elements/1.1/', '*');
diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc
index d4d7e895..c94cd8b0 100644
--- a/includes/ingest.form.inc
+++ b/includes/ingest.form.inc
@@ -65,7 +65,9 @@ function islandora_ingest_form(array $form, array &$form_state, array $configura
);
drupal_set_message($e->getMessage(), 'error');
return array(array(
- '#markup' => l(t('Back'), 'javascript:window.history.back();', array('external' => TRUE))));
+ '#markup' => l(t('Back'), 'javascript:window.history.back();', array('external' => TRUE)),
+ ),
+ );
}
}
@@ -285,7 +287,7 @@ function islandora_ingest_form_increment_step(array &$form_state) {
* The Drupal form state.
*/
function islandora_ingest_form_decrement_step(array &$form_state) {
- $previous_step_id = islandora_ingest_form_get_previous_step_id($form_state);
+ $previous_step_id = islandora_ingest_form_get_previous_step_id($form_state);
// Don't decrement passed the first step.
if (isset($previous_step_id)) {
islandora_ingest_form_stash_info($form_state);
@@ -496,7 +498,7 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s
*/
function islandora_ingest_form_add_step_context(array &$form, array $form_state) {
$items = array();
- $get_label = function(AbstractObject $collection = NULL, AbstractObject $fedora_cmodel) {
+ $get_label = function (AbstractObject $collection = NULL, AbstractObject $fedora_cmodel) {
if (isset($collection['COLLECTION_POLICY'])) {
$policy = new CollectionPolicy($collection['COLLECTION_POLICY']->content);
$policy_content_models = $policy->getContentModels();
@@ -513,7 +515,7 @@ function islandora_ingest_form_add_step_context(array &$form, array $form_state)
if (!isset($shared_storage['collection'])) {
$shared_storage['collection'] = NULL;
}
- foreach ($shared_storage['models'] as $key => $value) {
+ foreach ($shared_storage['models'] as $value) {
$fedora_cmodel = islandora_object_load($value);
if ($fedora_cmodel) {
if (is_array($shared_storage['collection'])) {
@@ -876,18 +878,18 @@ function &islandora_ingest_form_get_objects(array &$form_state) {
/**
* Gets a single object from the stored NewFedoraObject's.
*
- * @note In our current use case we are only dealing with a single object
- * ingest, this makes it convenient to access it. Ideally the steps
- * implementations will be abstracted to be indifferent to what object it's
- * currently working on. This will act as a placeholder for such
- * functionality.
- *
* @param array $form_state
* The Drupal form state.
*
* @return NewFedoraObject
* Returns the 'current' object in the array of NewFedoraObjects, generally
* this is only used when there is one object in the list of objects.
+ *
+ * @note In our current use case we are only dealing with a single object
+ * ingest, this makes it convenient to access it. Ideally the steps
+ * implementations will be abstracted to be indifferent to what object it's
+ * currently working on. This will act as a placeholder for such
+ * functionality.
*/
function islandora_ingest_form_get_object(array &$form_state) {
$objects = &islandora_ingest_form_get_objects($form_state);
@@ -899,7 +901,7 @@ function islandora_ingest_form_get_object(array &$form_state) {
*
* @param array $form_state
* The Drupal form state.
- * @param array $step_id
+ * @param string $step_id
* The ID of the step.
*
* @return array
@@ -943,6 +945,7 @@ function islandora_ingest_form_load_include(array &$form_state) {
if (isset($step['file']) && isset($step['module'])) {
$matches = array();
preg_match('/^(.*)\.(.*)$/', $step['file'], $matches);
+ // @codingStandardsIgnoreLine
list($file, $name, $type) = $matches;
form_load_include($form_state, $type, $step['module'], $name);
}
@@ -1004,7 +1007,7 @@ function islandora_ingest_form_get_steps(array &$form_state) {
*/
function islandora_ingest_form_get_form_steps(array &$form_state) {
$steps = islandora_ingest_form_get_steps($form_state);
- $form_step_filter = function($o) {
+ $form_step_filter = function ($o) {
return $o['type'] == 'form';
};
return array_filter($steps, $form_step_filter);
@@ -1022,7 +1025,7 @@ function islandora_ingest_form_get_form_steps(array &$form_state) {
*/
function islandora_ingest_form_get_callback_steps(array &$form_state) {
$steps = islandora_ingest_form_get_steps($form_state);
- $callback_step_filter = function($o) {
+ $callback_step_filter = function ($o) {
return $o['type'] == 'callback';
};
return array_filter($steps, $callback_step_filter);
diff --git a/includes/manage_deleted_objects.inc b/includes/manage_deleted_objects.inc
index a6b5e96e..d209783b 100644
--- a/includes/manage_deleted_objects.inc
+++ b/includes/manage_deleted_objects.inc
@@ -16,7 +16,7 @@
* @return array
* The Drupal form definition.
*/
-function islandora_deleted_objects_prep_form($form, $form_state, $serialized_chosen = NULL) {
+function islandora_deleted_objects_prep_form(array $form, array $form_state, $serialized_chosen = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
$chosen_contentmodels = array();
if ($serialized_chosen) {
@@ -67,9 +67,9 @@ function islandora_deleted_objects_prep_form($form, $form_state, $serialized_cho
* @param array $form_state
* The form state.
*/
-function islandora_deleted_objects_prep_form_submit($form, $form_state) {
+function islandora_deleted_objects_prep_form_submit(array $form, array $form_state) {
$content_models = $form_state['values']['contentmodels'];
- $chosen = function($element) {
+ $chosen = function ($element) {
return $element;
};
$serialized_contentmodels = serialize(array_filter($content_models, $chosen));
@@ -87,7 +87,7 @@ function islandora_deleted_objects_prep_form_submit($form, $form_state) {
* @return array
* The Drupal form definition.
*/
-function islandora_deleted_objects_manage_form($form, $form_state, $serialized_chosen = NULL) {
+function islandora_deleted_objects_manage_form(array $form, array $form_state, $serialized_chosen = NULL) {
$form['previous'] = array(
'#type' => 'submit',
'#value' => t('Previous'),
@@ -186,7 +186,7 @@ function islandora_deleted_objects_manage_form($form, $form_state, $serialized_c
* @param array $form_state
* The form state.
*/
-function islandora_deleted_objects_manage_form_submit($form, $form_state) {
+function islandora_deleted_objects_manage_form_submit(array $form, array $form_state) {
module_load_include('inc', 'islandora', 'includes/utilities');
$serialized_chosen = isset($form_state['values']['serialized_chosen']) ? $form_state['values']['serialized_chosen'] : NULL;
@@ -246,7 +246,8 @@ function islandora_get_deleted_objects($content_models, $limit, $offset) {
$cm_pid = $object['object']['value'];
$title = $object['label']['value'];
$deleted_objects[$pid] = array(
- 'title' => $title, 'pid' => $pid,
+ 'title' => $title,
+ 'pid' => $pid,
'content_model' => $content_models[$cm_pid],
);
}
@@ -288,7 +289,7 @@ function islandora_get_contentmodels_with_deleted_members() {
* Restores deleted object.
*
* @param string $pid
- * PID of object to be restored
+ * PID of object to be restored.
*/
function islandora_restore_object_by_pid($pid) {
$fedora_object = islandora_object_load($pid);
@@ -299,7 +300,7 @@ function islandora_restore_object_by_pid($pid) {
* Purges deleted object.
*
* @param string $pid
- * PID of object to be restored
+ * PID of object to be restored.
*/
function islandora_purge_object_by_pid($pid) {
$fedora_object = islandora_object_load($pid);
@@ -310,14 +311,14 @@ function islandora_purge_object_by_pid($pid) {
* Get query to find all deleted objects by content type.
*
* @param array $content_models
- * Content models to restrict search
+ * Content models to restrict search.
* @param int $offset
- * offset to be added to search
+ * Offset to be added to search.
*
* @return string
* Sparql query
*/
-function islandora_get_deleted_query($content_models, $offset = 0) {
+function islandora_get_deleted_query(array $content_models, $offset = 0) {
$candidates = array_keys($content_models);
$first_contentmodel = array_shift($candidates);
$prefix = "PREFIX fm: <" . FEDORA_MODEL_URI . "> ";
diff --git a/includes/metadata.inc b/includes/metadata.inc
index 90c30f9c..95ae4202 100644
--- a/includes/metadata.inc
+++ b/includes/metadata.inc
@@ -1,4 +1,5 @@
'item',
- '#markup' => (isset($profile['configuration']) AND $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '',
+ '#markup' => (isset($profile['configuration']) and $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '',
);
}
$form['viewers']['default'] = array(
@@ -135,7 +136,7 @@ function islandora_metadata_display_form($form, $form_state) {
* @param array $form_state
* An array containing the Drupal form state.
*/
-function islandora_metadata_display_form_submit($form, $form_state) {
+function islandora_metadata_display_form_submit(array $form, array $form_state) {
variable_set('islandora_metadata_display', $form_state['values']['viewers']['default']);
drupal_set_message(t('The configuration options have been saved.'));
}
diff --git a/includes/mime_detect.inc b/includes/mime_detect.inc
index 9b1145eb..b77a10a5 100644
--- a/includes/mime_detect.inc
+++ b/includes/mime_detect.inc
@@ -21,50 +21,86 @@
* http://api.drupal.org/api/function/file_default_mimetype_mapping/7
*/
+/**
+ * Class for doing mapping to mimetypes.
+ */
+// @codingStandardsIgnoreLine
class MimeDetect {
+ /**
+ * This is a shortlist of mimetypes.
+ *
+ * It should catch most mimetype<-->extension lookups in the context of
+ * Islandora collections.
+ *
+ * It has been cut from a much longer list.
+ *
+ * Two types of mimetypes should be put in this list:
+ * 1) Special emerging formats which may not yet be expressed in the system
+ * mime.types file.
+ * 2) Heavily used mimetypes of particular importance to the Islandora
+ * project, as lookups against this list will be quicker and less
+ * resource intensive than other methods.
+ *
+ * Lookups are first checked against this short list. If no results are
+ * found, then the lookup function may move on to check other sources,
+ * namely the system's mime.types file.
+ *
+ * In most cases though, this short list should suffice.
+ *
+ * If modifying this list, please note that for promiscuous mimetypes
+ * (those which map to multiple extensions, such as text/plain)
+ * The function get_extension will always return the *LAST* extension in
+ * this list, so you should put your preferred extension *LAST*.
+ *
+ * e.g...
+ * "jpeg" => "image/jpeg",
+ * "jpe" => "image/jpeg",
+ * "jpg" => "image/jpeg",
+ *
+ * $this->get_extension('image/jpeg') will always return 'jpg'.
+ *
+ * @var array
+ */
+ protected $protectedMimeTypes;
- protected $protectedMimeTypes = array(
- /*
- * This is a shortlist of mimetypes which should catch most
- * mimetype<-->extension lookups in the context of Islandora collections.
- *
- * It has been cut from a much longer list.
- *
- * Two types of mimetypes should be put in this list:
- * 1) Special emerging formats which may not yet be expressed in the system
- * mime.types file.
- * 2) Heavily used mimetypes of particular importance to the Islandora
- * project, as lookups against this list will be quicker and less
- * resource intensive than other methods.
- *
- * Lookups are first checked against this short list. If no results are
- * found, then the lookup function may move on to check other sources,
- * namely the system's mime.types file.
- *
- * In most cases though, this short list should suffice.
- *
- * If modifying this list, please note that for promiscuous mimetypes
- * (those which map to multiple extensions, such as text/plain)
- * The function get_extension will always return the *LAST* extension in
- * this list, so you should put your preferred extension *LAST*.
- *
- * e.g...
- * "jpeg" => "image/jpeg",
- * "jpe" => "image/jpeg",
- * "jpg" => "image/jpeg",
- *
- * $this->get_extension('image/jpeg') will always return 'jpg'.
- *
- */
- );
+ /**
+ * This is a shortlist of file extensions.
+ *
+ * @var array
+ */
protected $protectedFileExtensions;
+
+ /**
+ * Extension exceptions.
+ *
+ * XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping...
+ * The correct MIMEtype is 'image/tiff'.
+ *
+ * @var array
+ */
protected $extensionExceptions = array(
- // XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping...
- // The correct MIMEtype is 'image/tiff'.
'image/tif' => 'tif',
);
+
+ /**
+ * Stores the system list of mimetypes.
+ *
+ * @var array
+ */
protected $systemTypes;
+
+ /**
+ * Stores the system list of extensions.
+ *
+ * @var array
+ */
protected $systemExts;
+
+ /**
+ * System mime.types file location.
+ *
+ * @var string
+ */
protected $etcMimeTypes = '/etc/mime.types';
/**
@@ -87,7 +123,7 @@ class MimeDetect {
* Gets MIME type associated with the give file's extension.
*
* @param string $filename
- * The filename
+ * The filename.
* @param bool $debug
* Returns a debug array.
*
@@ -171,7 +207,8 @@ class MimeDetect {
/**
* Gets an associative array of MIME type and extension associations.
*
- * Users the system mime.types file, or a local mime.types if one is found
+ * Users the system mime.types file, or a local mime.types if one is found.
+ *
* @see MIMEDetect::__constuctor()
*
* @return array
@@ -206,7 +243,8 @@ class MimeDetect {
/**
* Gets a associative array of extensions and MIME types.
*
- * Users the system mime.types file, or a local mime.types if one is found
+ * Users the system mime.types file, or a local mime.types if one is found.
+ *
* @see MIMEDetect::__constuctor()
*
* @return array
@@ -262,4 +300,5 @@ class MimeDetect {
};
return array_keys(array_filter($this->protectedMimeTypes, $filter));
}
+
}
diff --git a/includes/mime_type.autocomplete.inc b/includes/mime_type.autocomplete.inc
index f24e4193..a5b249c1 100644
--- a/includes/mime_type.autocomplete.inc
+++ b/includes/mime_type.autocomplete.inc
@@ -1,4 +1,5 @@
"application/warc",
"json" => "application/json",
- // JSON-LD
+ // JSON-LD.
"jsonld" => "application/ld+json",
);
}
diff --git a/includes/object.entity_controller.inc b/includes/object.entity_controller.inc
index 87b5e4de..b1eec0ea 100644
--- a/includes/object.entity_controller.inc
+++ b/includes/object.entity_controller.inc
@@ -5,6 +5,9 @@
* Very basic entity controller.
*/
+/**
+ * Very basic entity controller for Islandora.
+ */
class IslandoraObjectEntityController implements DrupalEntityControllerInterface {
/**
@@ -28,7 +31,9 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface
* @return array
* An array of loaded objects.
*/
+ // @codingStandardsIgnoreStart
public function load($ids = array(), $conditions = array()) {
+ // @codingStandardsIgnoreEnd
if (!empty($conditions)) {
// TODO: Allow loading by specifying IDs in the condition.
throw new Exception('Conditions not implemented.');
@@ -54,4 +59,5 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface
public function resetCache(array $ids = NULL) {
// no-op.
}
+
}
diff --git a/includes/object_properties.form.inc b/includes/object_properties.form.inc
index 85a98342..617751e9 100644
--- a/includes/object_properties.form.inc
+++ b/includes/object_properties.form.inc
@@ -68,7 +68,11 @@ function islandora_object_properties_form(array $form, array &$form_state, Abstr
'#required' => TRUE,
'#description' => t("The object's state (active, inactive or deleted)"),
'#type' => 'select',
- '#options' => array('A' => 'Active', 'I' => 'Inactive', 'D' => 'Deleted'),
+ '#options' => array(
+ 'A' => t('Active'),
+ 'I' => t('Inactive'),
+ 'D' => t('Deleted'),
+ ),
),
'propogate' => array(
'#title' => t('Apply changes to related objects?'),
@@ -90,7 +94,8 @@ function islandora_object_properties_form(array $form, array &$form_state, Abstr
'#type' => 'submit',
'#access' => islandora_object_access(ISLANDORA_PURGE, $object),
'#value' => t("Permanently remove '@label' from repository", array(
- '@label' => truncate_utf8($object->label, 32, TRUE, TRUE))
+ '@label' => truncate_utf8($object->label, 32, TRUE, TRUE),
+ )
),
'#submit' => array('islandora_object_properties_form_delete'),
'#limit_validation_errors' => array(array('pid')),
@@ -150,7 +155,7 @@ function islandora_object_properties_form_submit(array $form, array &$form_state
if (isset($label) && $label != $object->label) {
try {
$object->label = $label;
- drupal_set_message(t('Successfully updated label %s', array('%s' => check_plain($label))));
+ drupal_set_message(t('Successfully updated label %s', array('%s' => $label)));
}
catch (Exception $e) {
form_set_error(t('Error updating label %s', array('%s' => $e->getMessage())));
@@ -200,15 +205,15 @@ function islandora_object_properties_form_delete(array $form, array &$form_state
* Updates object state.
*
* @param string $pid
- * PID of object to be updated
+ * PID of object to be updated.
* @param bool $update_states
- * If TRUE, update object state
+ * If TRUE, update object state.
* @param string $state
- * Desired object state
+ * Desired object state.
* @param bool $update_owners
- * If TRUE, update Owner
+ * If TRUE, update Owner.
* @param string $owner
- * New Owner
+ * New Owner.
*/
function islandora_update_object_properties($pid, $update_states, $state, $update_owners, $owner) {
$fedora_object = islandora_object_load($pid);
diff --git a/includes/regenerate_derivatives.form.inc b/includes/regenerate_derivatives.form.inc
index 1312bec3..321781c4 100644
--- a/includes/regenerate_derivatives.form.inc
+++ b/includes/regenerate_derivatives.form.inc
@@ -122,8 +122,8 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da
return array(
'title' => t('Regenerating derivatives for the @dsid datastream', array('@dsid' => $datastream->id)),
'operations' => islandora_do_batch_derivatives($datastream->parent, array(
- 'force' => TRUE,
- 'destination_dsid' => $datastream->id,
+ 'force' => TRUE,
+ 'destination_dsid' => $datastream->id,
)),
'init_message' => t('Preparing to regenerate derivatives...'),
'progress_message' => t('Time elapsed: @elapsed
Estimated time remaining @estimate.'),
@@ -139,7 +139,7 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da
* @param string $function
* The name of the function we are calling for derivatives.
* @param bool|string $file
- * FALSE if there is no file to load, the path to require otherwise
+ * FALSE if there is no file to load, the path to require otherwise.
* @param string $pid
* The pid of the object we are performing.
* @param bool $force
@@ -149,7 +149,7 @@ function islandora_regenerate_datastream_derivative_batch(AbstractDatastream $da
* @param array $context
* The context of the current batch operation.
*/
-function islandora_derivative_perform_batch_operation($function, $file, $pid, $force, $hook, &$context) {
+function islandora_derivative_perform_batch_operation($function, $file, $pid, $force, array $hook, array &$context) {
if ($file) {
require_once $file;
}
@@ -174,7 +174,7 @@ function islandora_derivative_perform_batch_operation($function, $file, $pid, $f
* @param array $operations
* An array of operations passed from the batch.
*/
-function islandora_regenerate_derivative_batch_finished($success, $results, $operations) {
+function islandora_regenerate_derivative_batch_finished(array $success, array $results, array $operations) {
module_load_include('inc', 'islandora', 'includes/derivatives');
if (!empty($results['logging'])) {
islandora_derivative_logging($results['logging']);
diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc
index c5856e38..d38037f0 100644
--- a/includes/solution_packs.inc
+++ b/includes/solution_packs.inc
@@ -105,12 +105,12 @@ function islandora_solution_packs_admin() {
* @return array
* The Drupal form definition.
*/
-function islandora_solution_pack_form(array $form, array &$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
+function islandora_solution_pack_form(array $form, array &$form_state, $solution_pack_module, $solution_pack_name, array $objects = array()) {
// The order is important in terms of severity of the status, where higher
// index indicates the status is more serious, this will be used to determine
// what messages get displayed to the user.
- $ok_image = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
- $warning_image = theme_image(array('path' => 'misc/watchdog-warning.png', 'attributes' => array()));
+ $ok_image = theme('image', array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
+ $warning_image = theme('image', array('path' => 'misc/watchdog-warning.png', 'attributes' => array()));
$status_info = array(
'up_to_date' => array(
'solution_pack' => t('All required objects are installed and up-to-date.'),
@@ -145,7 +145,8 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution
$header = array(
'label' => t('Label'),
'pid' => t('PID'),
- 'status' => t('Status'));
+ 'status' => t('Status'),
+ );
$object_info = array();
foreach ($objects as $object) {
@@ -161,7 +162,8 @@ function islandora_solution_pack_form(array $form, array &$form_state, $solution
$object_info[] = array(
'label' => $label,
'pid' => $object->id,
- 'status' => $status_msg);
+ 'status' => $status_msg,
+ );
}
$solution_pack_status = $status_severities[$solution_pack_status_severity];
$solution_pack_status_info = $status_info[$solution_pack_status];
@@ -260,7 +262,7 @@ function islandora_solution_pack_form_submit(array $form, array &$form_state) {
* @return array
* An array defining a batch which can be passed on to batch_set().
*/
-function islandora_solution_pack_get_batch($module, $not_checked = array()) {
+function islandora_solution_pack_get_batch($module, array $not_checked = array()) {
$batch = array(
'title' => t('Installing / Updating solution pack objects'),
'file' => drupal_get_path('module', 'islandora') . '/includes/solution_packs.inc',
@@ -299,8 +301,8 @@ function islandora_solution_pack_batch_operation_reingest_object(AbstractObject
if (!$deleted) {
$object_link = l($existing_object->label, "islandora/object/{$existing_object->id}");
drupal_set_message(filter_xss(t('Failed to purge existing object !object_link.', array(
- '!object_link' => $object_link,
- ))), 'error');
+ '!object_link' => $object_link,
+ ))), 'error');
// Failed to purge don't attempt to ingest.
return;
}
@@ -378,9 +380,6 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS
drupal_load('module', 'islandora');
module_load_include('inc', 'islandora', 'includes/utilities');
drupal_load('module', $module);
- $info_file = drupal_get_path('module', $module) . "/{$module}.info";
- $info_array = drupal_parse_info_file($info_file);
- $module_name = $info_array['name'];
if (!islandora_describe_repository()) {
$msg = $t('@module: Did not install any objects. Could not connect to the repository. Please check the settings on the !config_link page and install the required objects manually on the !admin_link page.', $t_params);
drupal_set_message(filter_xss($msg), 'error');
@@ -405,8 +404,8 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS
$object_status = islandora_check_object_status($object);
$here_params = array(
'!summary' => $t("@module: Did not install !object_link.", array(
- '!object_link' => $object_link,
- ) + $t_params),
+ '!object_link' => $object_link,
+ ) + $t_params),
'!description' => $status_messages[$object_status['status']],
);
drupal_set_message(filter_xss(format_string('!summary !description', $here_params)), 'warning');
@@ -422,25 +421,25 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS
if ($object) {
if ($deleted) {
drupal_set_message(filter_xss($t('@module: Successfully reinstalled. !object_link.', array(
- '!object_link' => $object_link,
- ) + $t_params)), 'status');
+ '!object_link' => $object_link,
+ ) + $t_params)), 'status');
}
else {
drupal_set_message(filter_xss($t('@module: Successfully installed. !object_link.', array(
- '!object_link' => $object_link,
- ) + $t_params)), 'status');
+ '!object_link' => $object_link,
+ ) + $t_params)), 'status');
}
}
else {
drupal_set_message($t('@module: Failed to install. @label.', array(
- '@label' => $label,
- ) + $t_params), 'warning');
+ '@label' => $label,
+ ) + $t_params), 'warning');
}
}
else {
drupal_set_message($t('@module: "@label" already exists and failed to be deleted.', array(
- '@label' => $label,
- ) + $t_params), 'warning');
+ '@label' => $label,
+ ) + $t_params), 'warning');
}
}
}
@@ -535,7 +534,7 @@ function islandora_check_object_status(AbstractObject $object_definition) {
);
}
- $is_xml_datastream = function($ds) {
+ $is_xml_datastream = function ($ds) {
return $ds->mimetype == 'text/xml';
};
$xml_datastreams = array_filter(iterator_to_array($object_definition), $is_xml_datastream);
@@ -627,11 +626,11 @@ function islandora_check_object_status(AbstractObject $object_definition) {
* that supports either the give $mimetype or $model will be listed.
*
* @param string $variable_id
- * The ID of the Drupal variable to save the viewer settings in
+ * The ID of the Drupal variable to save the viewer settings in.
* @param string $mimetype
- * The table will be populated with viewers supporting this mimetype
+ * The table will be populated with viewers supporting this mimetype.
* @param string $model
- * The table will be populated with viewers supporting this content model
+ * The table will be populated with viewers supporting this content model.
*
* @return array
* A form api array which defines a themed table to select a viewer.
@@ -680,7 +679,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model =
);
$form['viewers'][$variable_id]['configuration'][$name] = array(
'#type' => 'item',
- '#markup' => (isset($profile['configuration']) AND $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '',
+ '#markup' => (isset($profile['configuration']) and $profile['configuration'] != '') ? l(t('configure'), $profile['configuration']) : '',
);
}
$form['viewers'][$variable_id]['default'] = array(
@@ -717,7 +716,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model =
* @return array
* Viewer definitions, or FALSE if none are found.
*/
-function islandora_get_viewers($mimetype = array(), $content_model = NULL) {
+function islandora_get_viewers(array $mimetype = array(), $content_model = NULL) {
$viewers = array();
$defined_viewers = module_invoke_all('islandora_viewer_info');
@@ -729,7 +728,7 @@ function islandora_get_viewers($mimetype = array(), $content_model = NULL) {
foreach ($defined_viewers as $key => $value) {
$value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array();
$value['model'] = isset($value['model']) ? $value['model'] : array();
- if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) {
+ if (array_intersect($mimetype, $value['mimetype']) or in_array($content_model, $value['model'])) {
$viewers[$key] = $value;
}
}
@@ -763,10 +762,10 @@ function theme_islandora_viewers_table($variables) {
$output = '';
$output .= theme('table', array(
- 'header' => $header,
- 'rows' => $rows,
- 'attributes' => array('id' => 'islandora-viewers-table'),
- ));
+ 'header' => $header,
+ 'rows' => $rows,
+ 'attributes' => array('id' => 'islandora-viewers-table'),
+ ));
$output .= drupal_render_children($form);
return $output;
}
@@ -774,22 +773,22 @@ function theme_islandora_viewers_table($variables) {
/**
* Gather information and return a rendered viewer.
*
- * @param array/string $params
- * Array or string with data the module needs in order to render a full viewer
+ * @param array|string $params
+ * Array or string with data the module needs to render a full viewer.
* @param string $variable_id
- * The id of the Drupal variable the viewer settings are saved in
+ * The id of the Drupal variable the viewer settings are saved in.
* @param AbstractObject $fedora_object
- * The tuque object representing the fedora object being displayed
+ * The tuque object representing the fedora object being displayed.
*
* @return string
* The callback to the viewer module. Returns a rendered viewer. Returns FALSE
* if no viewer is set.
*/
-function islandora_get_viewer($params = NULL, $variable_id = NULL, $fedora_object = NULL) {
+function islandora_get_viewer($params = NULL, $variable_id = NULL, AbstractObject $fedora_object = NULL) {
$settings = variable_get($variable_id, array());
- if (!empty($settings) AND $settings['default'] !== 'none') {
+ if (!empty($settings) and $settings['default'] !== 'none') {
$viewer_id = islandora_get_viewer_id($variable_id);
- if ($viewer_id AND $params !== NULL) {
+ if ($viewer_id and $params !== NULL) {
$callback = islandora_get_viewer_callback($viewer_id);
if (function_exists($callback)) {
return $callback($params, $fedora_object);
@@ -803,7 +802,7 @@ function islandora_get_viewer($params = NULL, $variable_id = NULL, $fedora_objec
* Get id of the enabled viewer.
*
* @param string $variable_id
- * The ID of the Drupal variable the viewer settings are saved in
+ * The ID of the Drupal variable the viewer settings are saved in.
*
* @return string
* The enabled viewer id. Returns FALSE if no viewer config is set.
@@ -834,6 +833,7 @@ function islandora_get_viewer_callback($viewer_id = NULL) {
}
return FALSE;
}
+
/**
* @} End of "defgroup viewer-functions".
*/
diff --git a/includes/tuque.inc b/includes/tuque.inc
index 7aed2556..919f10cb 100644
--- a/includes/tuque.inc
+++ b/includes/tuque.inc
@@ -28,17 +28,20 @@ $islandora_module_path = drupal_get_path('module', 'islandora');
@include_once "$islandora_module_path/libraries/tuque/Repository.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraRelationships.php";
+/**
+ * Class for setting up tuque in Islandora.
+ */
class IslandoraTuque {
/**
- * Connection to the repository
+ * Connection to the repository.
*
* @var RepositoryConnection
*/
public $connection = NULL;
/**
- * The Fedora API we are using
+ * The Fedora API we are using.
*
* @var FedoraAPI
*/
@@ -61,14 +64,14 @@ class IslandoraTuque {
/**
* Constructor.
*
- * @param array $user
+ * @param object $user
* A Drupal user.
* @param string $url
* The url to the fedora instance.
*/
public function __construct($user = NULL, $url = NULL) {
if (!isset($user)) {
- global $user;
+ $user = $GLOBALS['user'];;
}
if ($user->uid == 0) {
@@ -113,4 +116,5 @@ class IslandoraTuque {
$message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array('!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link));
drupal_set_message(filter_xss($message), 'error', FALSE);
}
+
}
diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc
index 19b73b0f..6508af1a 100644
--- a/includes/tuque_wrapper.inc
+++ b/includes/tuque_wrapper.inc
@@ -2,8 +2,9 @@
/**
* @file
- * Wrapper around the tuque library, allows for autoloading of Islandora Tuque
- * Objects.
+ * Wrapper around the tuque library.
+ *
+ * Allows for autoloading of Islandora Tuque Objects.
*
* @todo Overload functions and apply pre/post hooks.
*/
@@ -75,6 +76,9 @@ function islandora_invoke_datastream_hooks($hook, array $models, $dsid) {
return islandora_invoke_hook_list($hook, $refinements, array_slice(func_get_args(), 3));
}
+/**
+ * Wraps the Tuque FedoraRepository class.
+ */
class IslandoraFedoraRepository extends FedoraRepository {
protected $queryClass = 'IslandoraRepositoryQuery';
protected $newObjectClass = 'IslandoraNewFedoraObject';
@@ -119,9 +123,10 @@ class IslandoraFedoraRepository extends FedoraRepository {
}
catch (Exception $e) {
watchdog('islandora', 'Failed to ingest object: @pidcode: @code
message: @msg', array(
- '@pid' => $object->id,
- '@code' => $e->getCode(),
- '@msg' => $e->getMessage()), WATCHDOG_ERROR);
+ '@pid' => $object->id,
+ '@code' => $e->getCode(),
+ '@msg' => $e->getMessage(),
+ ), WATCHDOG_ERROR);
throw $e;
}
}
@@ -151,7 +156,7 @@ class IslandoraFedoraRepository extends FedoraRepository {
/**
* Helper for three-valued logic with UUIDs.
*
- * @param bool|NULL $to_create
+ * @param bool|null $to_create
* The variable to test.
*
* @return bool
@@ -159,21 +164,32 @@ class IslandoraFedoraRepository extends FedoraRepository {
* 'islandora_basic_collection_generate_uuid' Drupal variable; otherwise,
* the value of $to_create itself.
*/
- protected static function useUUIDs($to_create) {
+ protected static function useUuids($to_create) {
return is_null($to_create) ?
variable_get('islandora_basic_collection_generate_uuid', FALSE) :
$to_create;
}
+
}
+/**
+ * Wraps tuques RepositoryQuery.
+ */
class IslandoraRepositoryQuery extends RepositoryQuery {}
+/**
+ * Wraps tuques NewFedoraObject.
+ */
class IslandoraNewFedoraObject extends NewFedoraObject {
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
+
}
+/**
+ * Wraps Tuques FedoraObject.
+ */
class IslandoraFedoraObject extends FedoraObject {
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
@@ -275,9 +291,10 @@ class IslandoraFedoraObject extends FedoraObject {
}
catch (Exception $e) {
watchdog('islandora', 'Failed to modify object: @pidcode: @code
message: @msg', array(
- '@pid' => $this->id,
- '@code' => $e->getCode(),
- '@msg' => $e->getMessage()), WATCHDOG_ERROR);
+ '@pid' => $this->id,
+ '@code' => $e->getCode(),
+ '@msg' => $e->getMessage(),
+ ), WATCHDOG_ERROR);
throw $e;
}
}
@@ -322,16 +339,22 @@ class IslandoraFedoraObject extends FedoraObject {
}
catch (Exception $e) {
watchdog('islandora', 'Failed to purge datastream @dsid from @pidcode: @code
message: @msg', array(
- '@pid' => $this->id,
- '@dsid' => $id,
- '@code' => $e->getCode(),
- '@msg' => $e->getMessage()), WATCHDOG_ERROR);
+ '@pid' => $this->id,
+ '@dsid' => $id,
+ '@code' => $e->getCode(),
+ '@msg' => $e->getMessage(),
+ ), WATCHDOG_ERROR);
throw $e;
}
}
+
}
+/**
+ * Wraps tuques RepositoryConnection.
+ */
class IslandoraRepositoryConnection extends RepositoryConnection {
+
/**
* Constructor.
*
@@ -345,8 +368,12 @@ class IslandoraRepositoryConnection extends RepositoryConnection {
parent::__construct($url, $username, $password);
drupal_alter('islandora_repository_connection_construction', $this);
}
+
}
+/**
+ * Wraps Tuques FedoraApi.
+ */
class IslandoraFedoraApi extends FedoraApi {
/**
@@ -362,8 +389,12 @@ class IslandoraFedoraApi extends FedoraApi {
$this->m = new IslandoraFedoraApiM($connection, $serializer);
$this->connection = $connection;
}
+
}
+/**
+ * Wraps Tuques FedoraApiM.
+ */
class IslandoraFedoraApiM extends FedoraApiM {
/**
@@ -452,9 +483,10 @@ class IslandoraFedoraApiM extends FedoraApiM {
}
catch (Exception $e) {
watchdog('islandora', 'Failed to purge object @pidcode: @code
message: @msg', array(
- '@pid' => $pid,
- '@code' => $e->getCode(),
- '@msg' => $e->getMessage()), WATCHDOG_ERROR);
+ '@pid' => $pid,
+ '@code' => $e->getCode(),
+ '@msg' => $e->getMessage(),
+ ), WATCHDOG_ERROR);
throw $e;
}
}
@@ -505,7 +537,7 @@ class IslandoraFedoraApiM extends FedoraApiM {
*
* All extra arguments are passed along to the callback.
*
- * @param callable $callback
+ * @param string $callback
* The method we are wrapping.
* @param string $pid
* The PID to create a semaphore for.
@@ -540,15 +572,26 @@ class IslandoraFedoraApiM extends FedoraApiM {
return call_user_func_array(array($this, "parent::$callback"), $args);
}
}
+
}
+/**
+ * Wraps Tuques SimpleCache.
+ */
class IslandoraSimpleCache extends SimpleCache {}
+/**
+ * Wraps Tuques NewFedoraDatastream.
+ */
class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
+
}
+/**
+ * Wraps tuques FedoraDatastream.
+ */
class IslandoraFedoraDatastream extends FedoraDatastream {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
@@ -610,20 +653,32 @@ class IslandoraFedoraDatastream extends FedoraDatastream {
}
catch (Exception $e) {
watchdog('islandora', 'Failed to modify datastream @dsid from @pidcode: @code
message: @msg', array(
- '@pid' => $this->parent->id,
- '@dsid' => $this->id,
- '@code' => $e->getCode(),
- '@msg' => $e->getMessage()), WATCHDOG_ERROR);
+ '@pid' => $this->parent->id,
+ '@dsid' => $this->id,
+ '@code' => $e->getCode(),
+ '@msg' => $e->getMessage(),
+ ), WATCHDOG_ERROR);
throw $e;
}
}
+
}
+/**
+ * Wraps tuques FedoraDatastreamVersion.
+ */
class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
+
}
+/**
+ * Wraps Tuques FedoraRelsExt.
+ */
class IslandoraFedoraRelsExt extends FedoraRelsExt {}
+/**
+ * Wraps Tuques FedoraRelsInt.
+ */
class IslandoraFedoraRelsInt extends FedoraRelsInt {}
diff --git a/includes/utilities.inc b/includes/utilities.inc
index dcbaab02..c3bb4dbf 100644
--- a/includes/utilities.inc
+++ b/includes/utilities.inc
@@ -13,7 +13,7 @@
* XXX: Shouldn't Drupal's format_size() be preferred?
*
* @param int $bytes
- * Size in bytes to convert
+ * Size in bytes to convert.
* @param int $precision
* The amount of decimal precision to show.
*
@@ -175,8 +175,6 @@ function islandora_describe_repository($url = NULL) {
* as MODULE_REFINEMENT_HOOK. Any additional arguments passed to this function
* will be passed as arguments to module_invoke_all().
*
- * @see islandora_build_hook_list()
- *
* @param string $hook
* A hook to call.
* @param array $refinements
@@ -188,6 +186,8 @@ function islandora_describe_repository($url = NULL) {
*
* @return array
* The merged results from all the hooks.
+ *
+ * @see islandora_build_hook_list())
*/
function islandora_invoke_hook_list($hook, array $refinements, array $args) {
$return = array();
@@ -229,7 +229,7 @@ function islandora_invoke_hook_list($hook, array $refinements, array $args) {
* An array with each refinement escaped and concatenated with the base hook
* name, in addition to the base hook name.
*/
-function islandora_build_hook_list($hook, $refinements = array()) {
+function islandora_build_hook_list($hook, array $refinements = array()) {
$refinements = array_unique($refinements);
$hooks = array($hook);
foreach ($refinements as $refinement) {
@@ -333,7 +333,7 @@ function islandora_get_parents_from_rels_ext(AbstractObject $object) {
// @todo some logging would be nice, not sure what this throws.
return array();
}
- $map = function($o) {
+ $map = function ($o) {
return islandora_object_load($o['object']['value']);
};
$collections = array_map($map, $collections);
@@ -484,7 +484,7 @@ function islandora_get_datastreams_requirements_from_content_model(AbstractObjec
* @return NewFedoraObject
* An ingestable NewFedoraObject.
*/
-function islandora_prepare_new_object($name_source = NULL, $label = NULL, $datastreams = array(), $content_models = array(), $relationships = array()) {
+function islandora_prepare_new_object($name_source = NULL, $label = NULL, array $datastreams = array(), array $content_models = array(), array $relationships = array()) {
global $user;
$tuque = islandora_get_tuque_connection();
$object = isset($name_source) ? $tuque->repository->constructObject($name_source) : new IslandoraNewFedoraObject(NULL, $tuque->repository);
@@ -500,7 +500,7 @@ function islandora_prepare_new_object($name_source = NULL, $label = NULL, $datas
$dsid = $ds['dsid'];
$label = isset($ds['label']) ? $ds['label'] : '';
$mimetype = isset($ds['mimetype']) ? $ds['mimetype'] : 'text/xml';
- // Default 'Managed'
+ // Default 'Managed'.
$control_group = 'M';
$groups = array('X', 'M', 'R', 'E');
if (isset($ds['control_group']) && in_array($ds['control_group'], $groups)) {
@@ -598,7 +598,7 @@ function islandora_display_repository_inaccessible_message() {
function islandora_executable_available_message($path, $version = NULL, $required_version = NULL) {
$available = is_executable($path);
if ($available) {
- $image = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
+ $image = theme('image', array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
$message = t('Executable found at @path', array('@path' => $path));
if ($version) {
$message .= t('
Version: @version', array('@version' => $version));
@@ -606,12 +606,12 @@ function islandora_executable_available_message($path, $version = NULL, $require
if ($required_version) {
$message .= t('
Required Version: @version', array('@version' => $required_version));
if (version_compare($version, $required_version) < 0) {
- $image = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
+ $image = theme('image', array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
}
}
}
else {
- $image = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
+ $image = theme('image', array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
$message = t('Unable to locate executable at @path', array('@path' => $path));
}
return $image . $message;
@@ -629,11 +629,11 @@ function islandora_executable_available_message($path, $version = NULL, $require
function islandora_directory_exists_message($path) {
$available = is_dir($path);
if ($available) {
- $image = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
+ $image = theme('image', array('path' => 'misc/watchdog-ok.png', 'attributes' => array()));
$message = t('Directory found at @path', array('@path' => $path));
}
else {
- $image = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
+ $image = theme('image', array('path' => 'misc/watchdog-error.png', 'attributes' => array()));
$message = t('Unable to locate directory at @path', array('@path' => $path));
}
return $image . $message;
@@ -735,14 +735,14 @@ function islandora_get_content_models($ignore_system_namespace = TRUE) {
* @param string $drupal_variable
* the name of the Drupal variable holding selected content models
* Content models held in this variable will appear at the top of
- * the displayed list
+ * the displayed list.
* @param array $default_values_array
- * default values to display if $drupal_variable is unset
+ * Default values to display if $drupal_variable is unset.
*
* @return array
* Drupal form element allowing content model selection
*/
-function islandora_content_model_select_table_form_element($drupal_variable, $default_values_array = array('')) {
+function islandora_content_model_select_table_form_element($drupal_variable, array $default_values_array = array('')) {
$defaults = array();
$rows = array();
$content_models = array();
@@ -835,7 +835,7 @@ function islandora_deprecated($release, $solution = NULL) {
* of strings, which we transform to renderable markup elements (by
* reference).
*/
-function islandora_as_renderable_array(&$markup_array) {
+function islandora_as_renderable_array(array &$markup_array) {
foreach ($markup_array as &$value) {
if (!is_array($value)) {
// Not a renderable array, just a string. Let's convert it to a
diff --git a/islandora.api.php b/islandora.api.php
index e553a894..4594e344 100644
--- a/islandora.api.php
+++ b/islandora.api.php
@@ -1,4 +1,5 @@
models)) {
$resource_url = url("islandora/object/{$object->id}/datastream/OBJ/view");
@@ -30,7 +31,8 @@ function hook_islandora_view_object($object, $user, $page_number, $page_size) {
// Theme the image seperatly.
$variables['islandora_img'] = theme('image', $params);
$output = theme('islandora_default_print', array(
- 'islandora_content' => $variables['islandora_img']));
+ 'islandora_content' => $variables['islandora_img'],
+ ));
}
return $output;
}
@@ -38,10 +40,10 @@ function hook_islandora_view_object($object, $user, $page_number, $page_size) {
/**
* Generate a print friendly page for the given object.
*
- * @param object $object
+ * @param AbstractObject $object
* The object form to print.
*/
-function hook_islandora_view_print_object($object) {
+function hook_islandora_view_print_object(AbstractObject $object) {
}
@@ -52,13 +54,13 @@ function hook_islandora_view_print_object($object) {
* create the hook name.
*
* @param AbstractObject $object
- * A Tuque FedoraObject
+ * A Tuque FedoraObject.
*
* @return array
* An array whose values are markup.
*/
-function hook_cmodel_pid_islandora_view_object($object) {
-
+function hook_cmodel_pid_islandora_view_object(AbstractObject $object) {
+ return array();
}
/**
@@ -69,21 +71,21 @@ function hook_cmodel_pid_islandora_view_object($object) {
* @param array $rendered
* The array of rendered views.
*/
-function hook_islandora_view_object_alter(&$object, &$rendered) {
+function hook_islandora_view_object_alter(AbstractObject &$object, array &$rendered) {
}
/**
* Alter display output if the object has the given model.
*
- * @see hook_islandora_view_object_alter()
- *
* @param AbstractObject $object
* A Tuque AbstractObject being operated on.
* @param array $rendered
* The array of rendered views.
+ *
+ * @see hook_islandora_view_object_alter()
*/
-function hook_cmodel_pid_islandora_view_object_alter(&$object, &$rendered) {
+function hook_cmodel_pid_islandora_view_object_alter(AbstractObject &$object, array &$rendered) {
}
@@ -91,13 +93,13 @@ function hook_cmodel_pid_islandora_view_object_alter(&$object, &$rendered) {
* Generate an object's datastreams management display.
*
* @param AbstractObject $object
- * A Tuque FedoraObject
+ * A Tuque FedoraObject.
*
* @return array
* An array whose values are markup.
*/
-function hook_islandora_edit_object($object) {
-
+function hook_islandora_edit_object(AbstractObject $object) {
+ return array();
}
/**
@@ -107,24 +109,24 @@ function hook_islandora_edit_object($object) {
* create the hook name.
*
* @param AbstractObject $object
- * A Tuque FedoraObject
+ * A Tuque FedoraObject.
*
* @return array
* An array whose values are markup.
*/
-function hook_cmodel_pid_islandora_edit_object($object) {
-
+function hook_cmodel_pid_islandora_edit_object(AbstractObject $object) {
+ return array();
}
/**
* Allow datastreams management display output to be altered.
*
* @param AbstractObject $object
- * A Tuque FedoraObject
+ * A Tuque FedoraObject.
* @param array $rendered
- * an arr of rendered views
+ * An arr of rendered views.
*/
-function hook_islandora_edit_object_alter(&$object, &$rendered) {
+function hook_islandora_edit_object_alter(AbstractObject &$object, array &$rendered) {
}
@@ -227,12 +229,12 @@ function hook_cmodel_pid_dsid_islandora_datastream_alter(AbstractObject $object,
* This hook is called after an object has been successfully ingested via a
* FedoraRepository object.
*
+ * @param AbstractObject $object
+ * The object that was ingested.
+ *
* @note
* If ingested directly via the FedoraApiM object this will not be called as we
* don't have access to the ingested object at that time.
- *
- * @param AbstractObject $object
- * The object that was ingested.
*/
function hook_islandora_object_ingested(AbstractObject $object) {
@@ -301,14 +303,14 @@ function hook_cmodel_pid_islandora_object_purged($pid) {
*
* This hook is called after the datastream has been successfully ingested.
*
- * @note
- * If ingested directly via the FedoraApiM object this will not be called as we
- * don't have access to the ingested datastream at that time.
- *
* @param AbstractObject $object
* The object the datastream belongs to.
* @param AbstractDatastream $datastream
* The ingested datastream.
+ *
+ * @note
+ * If ingested directly via the FedoraApiM object this will not be called as we
+ * don't have access to the ingested datastream at that time.
*/
function hook_islandora_datastream_ingested(AbstractObject $object, AbstractDatastream $datastream) {
@@ -394,7 +396,7 @@ function hook_cmodel_pid_dsid_islandora_datastream_purged(AbstractObject $object
* - name: A string containg a human-readable name for the entry.
* - url: A string containing the URL to which to the user will be routed.
*/
-function hook_islandora_edit_datastream_registry($object, $dsid) {
+function hook_islandora_edit_datastream_registry(AbstractObject $object, $dsid) {
$routes = array();
$routes[] = array(
'name' => t('My Awesome Edit Route'),
@@ -451,7 +453,7 @@ function hook_islandora_undeletable_datastreams(array $models) {
*
* @param array $form_state
* An array containing the form_state, on which infomation from step storage
- * might be extracted. Note that the
+ * might be extracted. Note that the.
*
* @return array
* An associative array of associative arrays which define each step in the
@@ -511,7 +513,6 @@ function hook_islandora_ingest_steps(array $form_state) {
*
* @param array $steps
* An array of steps as generated by hook_islandora_ingest_steps().
- *
* @param array $form_state
* An array containing the Drupal form_state.
*/
@@ -538,7 +539,6 @@ function hook_cmodel_pid_islandora_ingest_steps(array $form_state) {
*
* @param array $steps
* An array of steps as generated by hook_islandora_ingest_steps().
- *
* @param array $form_state
* An array containing the Drupal form_state.
*/
@@ -557,13 +557,13 @@ function hook_cmodel_pid_islandora_ingest_steps_alter(array &$steps, array &$for
* @param object $user
* A loaded user object, as the global $user variable might contain.
*
- * @return bool|NULL|array
+ * @return bool|null|array
* Either boolean TRUE or FALSE to explicitly allow or deny the operation on
* the given object, or NULL to indicate that we are making no assertion
* about the outcome. Can also be an array containing multiple
* TRUE/FALSE/NULLs, due to how hooks work.
*/
-function hook_islandora_object_access($op, $object, $user) {
+function hook_islandora_object_access($op, AbstractObject $object, $user) {
switch ($op) {
case 'create stuff':
return TRUE;
@@ -591,18 +591,18 @@ function hook_cmodel_pid_islandora_object_access($op, $object, $user) {
* @param string $op
* A string define an operation to check. Should be defined via
* hook_permission().
- * @param AbstractDatastream $object
+ * @param AbstractDatastream $ds
* An object to check the operation on.
* @param object $user
* A loaded user object, as the global $user variable might contain.
*
- * @return bool|NULL|array
+ * @return bool|null|array
* Either boolean TRUE or FALSE to explicitly allow or deny the operation on
* the given object, or NULL to indicate that we are making no assertion
* about the outcome. Can also be an array containing multiple
* TRUE/FALSE/NULLs, due to how hooks work.
*/
-function hook_islandora_datastream_access($op, $object, $user) {
+function hook_islandora_datastream_access($op, AbstractDatastream $ds, $user) {
switch ($op) {
case 'create stuff':
return TRUE;
@@ -664,7 +664,7 @@ function hook_cmodel_pid_islandora_overview_object_alter(AbstractObject &$object
* hierarchy.
*
* @param AbstractObject $object
- * Optional object to which derivatives will be added
+ * Optional object to which derivatives will be added.
* @param array $ds_modified_params
* An array that will contain the properties changed on the datastream if
* derivatives were triggered from a datastream_modified hook, as well as a
@@ -703,7 +703,7 @@ function hook_cmodel_pid_islandora_overview_object_alter(AbstractObject &$object
* - file: A string denoting the path to the file where the function
* is being called from.
*/
-function hook_islandora_derivative(AbstractObject $object = NULL, $ds_modified_params = array()) {
+function hook_islandora_derivative(AbstractObject $object = NULL, array $ds_modified_params = array()) {
$derivatives[] = array(
'source_dsid' => 'OBJ',
'destination_dsid' => 'DERIV',
@@ -777,7 +777,7 @@ function hook_cmodel_pid_islandora_derivative_alter() {
* Retrieves PIDS of related objects for property updating.
*
* @param AbstractObject $object
- * AbstractObject representing deleted object
+ * AbstractObject representing deleted object.
*/
function hook_islandora_update_related_objects_properties(AbstractObject $object) {
$related_objects = get_all_children_siblings_and_friends($object);
@@ -796,9 +796,9 @@ function hook_islandora_update_related_objects_properties(AbstractObject $object
* @param string $context
* Where the alter is originating from for distinguishing.
* @param AbstractObject $object
- * (Optional) AbstractObject representing object providing breadcrumb path
+ * (Optional) AbstractObject representing object providing breadcrumb path.
*/
-function hook_islandora_breadcrumbs_alter(&$breadcrumbs, $context, $object = NULL) {
+function hook_islandora_breadcrumbs_alter(array &$breadcrumbs, $context, AbstractObject $object = NULL) {
}
@@ -883,7 +883,7 @@ function hook_islandora_get_breadcrumb_query_predicates() {
* - original_edit_registry: The original edit_registry prior to any
* modifications.
*/
-function hook_islandora_edit_datastream_registry_alter(&$edit_registry, $context) {
+function hook_islandora_edit_datastream_registry_alter(array &$edit_registry, array $context) {
// Example: Remove xml form builder edit registry.
if (isset($edit_registry['xml_form_builder_edit_form_registry'])) {
unset($edit_registry['xml_form_builder_edit_form_registry']);
@@ -943,5 +943,5 @@ function hook_islandora_breadcrumbs_backends() {
*/
function callback_islandora_breadcrumbs_backends(AbstractObject $object) {
// Do something to get an array of breadcrumb links for $object, root first.
- return array($root_link, $collection_link, $object_link);
+ return array('root_link', 'collection_link', 'object_link');
}
diff --git a/islandora.drush.inc b/islandora.drush.inc
index 876f6e39..38c26ce1 100644
--- a/islandora.drush.inc
+++ b/islandora.drush.inc
@@ -175,7 +175,7 @@ function drush_islandora_solution_pack_install_content_models() {
if (module_exists($module)) {
$info = islandora_solution_packs_get_required_objects($module);
$objects_to_add = array();
- foreach ($info['objects'] as $key => $candidate) {
+ foreach ($info['objects'] as $candidate) {
if (in_array('fedora-system:ContentModel-3.0', $candidate->models)) {
$objects_to_add[] = $candidate;
}
diff --git a/islandora.module b/islandora.module
index 3349902c..c803ac81 100644
--- a/islandora.module
+++ b/islandora.module
@@ -4,7 +4,7 @@
* @file
* Defines all the hooks this module implements.
*
- * islandora.module: defines paths (drupal menu items) as entry points and acts
+ * Islandora.module: defines paths (drupal menu items) as entry points and acts
* as a hub for dispatching tasks to other modules.
*
* This file is part of Islandora.
@@ -75,7 +75,7 @@ const ISLANDORA_BREADCRUMB_LEGACY_BACKEND = 'islandora_breadcrumbs_legacy_sparql
* Implements hook_menu().
*
* We need some standard entry points so we can have consistent urls for
- * different Object actions
+ * different Object actions.
*/
function islandora_menu() {
$items = array();
@@ -189,7 +189,8 @@ function islandora_menu() {
ISLANDORA_ADD_DS,
ISLANDORA_PURGE,
ISLANDORA_INGEST,
- ), 2),
+ ), 2,
+ ),
);
$items['islandora/object/%islandora_object/manage/overview'] = array(
'title' => 'Overview',
@@ -207,7 +208,8 @@ function islandora_menu() {
ISLANDORA_METADATA_EDIT,
ISLANDORA_ADD_DS,
ISLANDORA_PURGE,
- ), 2),
+ ), 2,
+ ),
'weight' => -10,
);
$items['islandora/object/%islandora_object/manage/properties'] = array(
@@ -367,7 +369,7 @@ function islandora_menu() {
'title' => 'Event Status',
'page callback' => 'islandora_event_status',
'type' => MENU_CALLBACK,
- 'access callback' => TRUE,
+ 'access arguments' => array(ISLANDORA_VIEW_OBJECTS),
'file' => 'includes/utilities.inc',
);
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
@@ -429,7 +431,7 @@ function islandora_admin_paths() {
* The theme entries 'islandora_objects' and 'islandora_objects_subset'
* utilize the same template file. When theming, be sure to utilize the theme
* name, and not the template file names. Similar situation found here:
- * @link https://jira.duraspace.org/browse/ISLANDORA-934. @endlink
+ * @link https://jira.duraspace.org/browse/ISLANDORA-934. @endlink.
*/
function islandora_theme() {
return array(
@@ -710,7 +712,7 @@ function islandora_print_object(AbstractObject $object) {
* FALSE if 'islandora_show_print_option' is not selected in islandora
* configuraton.
*/
-function islandora_print_object_access($op, $object) {
+function islandora_print_object_access($op, AbstractObject $object) {
if (!variable_get('islandora_show_print_option', FALSE)) {
return FALSE;
}
@@ -738,8 +740,6 @@ function islandora_forms($form_id) {
* Will check the given user or the user repersented by the GET token parameter,
* failing that it will use the global user.
*
- * @global $user
- *
* @param mixed $object_or_datastream
* The AbstractObject or AbstractDatastream to test for accessibility, if NULL
* is given the object is assumed to not exist or be inaccessible.
@@ -759,8 +759,10 @@ function islandora_forms($form_id) {
* @return bool
* TRUE if the user is allowed to access this object/datastream, FALSE
* otherwise.
+ *
+ * @global $user
*/
-function islandora_user_access($object_or_datastream, array $permissions, $content_models = array(), $access_any = TRUE, $user = NULL) {
+function islandora_user_access($object_or_datastream, array $permissions, array $content_models = array(), $access_any = TRUE, $user = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
$is_repository_accessible = &drupal_static(__FUNCTION__);
@@ -799,7 +801,7 @@ function islandora_user_access($object_or_datastream, array $permissions, $conte
}
}
else {
- global $user;
+ $user = $GLOBALS['user'];
}
}
@@ -848,7 +850,7 @@ function islandora_user_access($object_or_datastream, array $permissions, $conte
* Checks whether the user can access the given object.
*
* Checks for object existance, accessiblitly, namespace permissions,
- * and user permissions
+ * and user permissions.
*
* @param string $perm
* User permission to test for.
@@ -859,7 +861,7 @@ function islandora_user_access($object_or_datastream, array $permissions, $conte
* @return bool
* TRUE if the user is allowed to access this object, FALSE otherwise.
*/
-function islandora_object_access_callback($perm, $object = NULL) {
+function islandora_object_access_callback($perm, AbstractObject $object = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
if (!$object && !islandora_describe_repository()) {
@@ -902,7 +904,7 @@ function islandora_object_datastream_tokened_access_callback($perm, $object = NU
* Checks whether the user can access the given object's manage tab.
*
* Checks for object existance, accessiblitly, namespace permissions,
- * and user permissions
+ * and user permissions.
*
* @param array $perms
* Array of user permission to test for.
@@ -913,7 +915,7 @@ function islandora_object_datastream_tokened_access_callback($perm, $object = NU
* @return bool
* TRUE if the user is allowed to access this object, FALSE otherwise.
*/
-function islandora_object_manage_access_callback($perms, $object = NULL) {
+function islandora_object_manage_access_callback(array $perms, AbstractObject $object = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
if (!$object && !islandora_describe_repository()) {
@@ -1128,7 +1130,7 @@ function islandora_drupal_title(AbstractObject $object) {
* @return array
* The default rendering of the object view page, indexed at 'Default output'.
*/
-function islandora_default_islandora_view_object($object) {
+function islandora_default_islandora_view_object(AbstractObject $object) {
$output = theme('islandora_default', array('islandora_object' => $object));
return array('Default output' => array('#markup' => $output));
}
@@ -1144,7 +1146,7 @@ function islandora_default_islandora_view_object($object) {
* @return array
* A renderable array
*/
-function islandora_default_islandora_printer_object($object, $alter) {
+function islandora_default_islandora_printer_object(AbstractObject $object, $alter) {
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/datastream');
module_load_include('inc', 'islandora', 'includes/metadata');
@@ -1153,7 +1155,6 @@ function islandora_default_islandora_printer_object($object, $alter) {
drupal_add_css($path . '/css/islandora.print.css');
$islandora_object = islandora_object_load($object->id);
- $repository = $islandora_object->repository;
try {
$dc = $islandora_object['DC']->content;
@@ -1168,7 +1169,8 @@ function islandora_default_islandora_printer_object($object, $alter) {
'object' => $object,
'dc_array' => $variables,
'metadata' => $metadata,
- 'islandora_content' => $alter));
+ 'islandora_content' => $alter,
+ ));
return array('Default output' => array('#markup' => $output));
}
@@ -1265,7 +1267,7 @@ function islandora_object_load($object_id) {
* @return FedoraObject
* A token authenticated object. @see islandora_object_load
*/
-function islandora_tokened_object_load($object_id, $map) {
+function islandora_tokened_object_load($object_id, array $map) {
if (array_key_exists('token', $_GET)) {
$token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING);
if ($token) {
@@ -1292,7 +1294,7 @@ function islandora_tokened_object_load($object_id, $map) {
* islandora_tokened_datastream_load(DSID, DSID, PID)
*
* @param mixed $datastream_id
- * %islandora_tokened_datastream @see islandora_datastream_load
+ * Menu path '%islandora_tokened_datastream' @see islandora_datastream_load.
* @param array $map
* Used to extract the Fedora object's PID at $map[2].
*
@@ -1301,7 +1303,7 @@ function islandora_tokened_object_load($object_id, $map) {
*
* @see islandora_datastream_load
*/
-function islandora_tokened_datastream_load($datastream_id, $map) {
+function islandora_tokened_datastream_load($datastream_id, array $map) {
return islandora_datastream_load($datastream_id, $map[2]);
}
@@ -1317,7 +1319,6 @@ function islandora_tokened_datastream_load($datastream_id, $map) {
* @param string $datastream_id
* The DSID of the datastream specified as '%islandora_datastream' to fetch
* from the given object in the menu path identified by '%islandora_object'.
- *
* @param mixed $object_id
* The object to load the datastream from. This can be a Fedora PID or
* an instantiated IslandoraAbstractObject as it implements __toString()
@@ -1353,7 +1354,7 @@ function islandora_datastream_load($datastream_id, $object_id) {
* @return int
* The datastreams version if found, NULL otherwise.
*/
-function islandora_get_islandora_datastream_version($object = NULL, $dsid = NULL, $datastream_file = NULL) {
+function islandora_get_islandora_datastream_version(AbstractObject $object = NULL, $dsid = NULL, $datastream_file = NULL) {
$return = NULL;
// @TODO, need better check for $object
if ($object && $object[$dsid]) {
@@ -1488,15 +1489,15 @@ function islandora_delete_object(AbstractObject &$object) {
/**
* Delete's or purges the given datastream.
*
- * @throws Exception
- * Which types are undefined, but more than likely because of the hooks
- * there will be several kinds.
- *
* @param AbstractDatastream $datastream
* The datastream to delete.
*
* @return bool
* TRUE if successful, FALSE otherwise.
+ *
+ * @throws Exception
+ * Which types are undefined, but more than likely because of the hooks
+ * there will be several kinds.
*/
function islandora_delete_datastream(AbstractDatastream &$datastream) {
$object = $datastream->parent;
@@ -1629,7 +1630,7 @@ function islandora_entity_property_info() {
* Implements hook_file_mimetype_mapping_alter().
*
* Grab custom Islandora mime type list
- * and add any missing ext/mimes to the Drupal mapping
+ * and add any missing ext/mimes to the Drupal mapping.
*/
function islandora_file_mimetype_mapping_alter(&$mapping) {
module_load_include('inc', 'islandora', 'includes/mimetype.utils');
@@ -1656,7 +1657,7 @@ function islandora_file_mimetype_mapping_alter(&$mapping) {
* @param string $op
* String identifying an operation to check. Should correspond to a
* permission declared via hook_permission().
- * @param AbstractObject $object
+ * @param object $object
* An object to check for permissions.
* @param object $user
* An optional loaded user object. Defaults to the global $user.
@@ -1674,7 +1675,7 @@ function islandora_object_access($op, $object, $user = NULL) {
return FALSE;
}
if ($user === NULL) {
- global $user;
+ $user = $GLOBALS['user'];
}
// Populate the cache on a miss.
@@ -1723,7 +1724,7 @@ function islandora_datastream_access($op, $datastream, $user = NULL) {
return NULL;
}
if ($user === NULL) {
- global $user;
+ $user = $GLOBALS['user'];
}
// Populate the cache on a miss.
@@ -1843,13 +1844,13 @@ function islandora_form_simpletest_test_form_alter(array &$form) {
$filter_path = $configuration['drupal_filter_file'];
$filter_status = is_writable($filter_path);
if ($filter_status) {
- $filter_status_message = theme_image(array('path' => 'misc/watchdog-ok.png', 'attributes' => array())) . " ";
+ $filter_status_message = theme('image', array('path' => 'misc/watchdog-ok.png', 'attributes' => array())) . " ";
$filter_status_message .= t("Drupal filter at @filter_path is writable by the server.", array(
'@filter_path' => $filter_path,
));
}
else {
- $filter_status_message = theme_image(array('path' => 'misc/watchdog-error.png', 'attributes' => array())) . " ";
+ $filter_status_message = theme('image', array('path' => 'misc/watchdog-error.png', 'attributes' => array())) . " ";
$filter_status_message .= t("Drupal filter at @filter_path is not writable by the server. Please make sure your webserver has permission to write to the Drupal filter. If the path given is incorrect, you will need to change it in your server's test config file, located in the Islandora module's 'tests' folder as test_config.ini or default.test_config.ini.", array(
'@filter_path' => $filter_path,
));
@@ -1991,7 +1992,7 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre
* Access for submenu items.
*
* @param string $package_name
- * Name of the package
+ * Name of the package.
*
* @return bool
* Access granted
@@ -1999,7 +2000,7 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre
function islandora_find_package($package_name) {
$results = system_get_info('module');
$found = FALSE;
- foreach ($results as $name => $values) {
+ foreach ($results as $values) {
if ($values['package'] == $package_name) {
$found = TRUE;
break;
diff --git a/islandora.rules.inc b/islandora.rules.inc
index 2ebaa519..569efff4 100644
--- a/islandora.rules.inc
+++ b/islandora.rules.inc
@@ -2,7 +2,7 @@
/**
* @file
- * Does rule type stuff,
+ * Does rule type stuff,.
*/
/**
@@ -158,7 +158,6 @@ function islandora_rules_base_xpath_parameters() {
);
}
-
/**
* Implements hook_rules_condition_info().
*/
@@ -397,7 +396,7 @@ function islandora_rules_datastream_load_domxpath($string) {
* A loaded Drupal taxonomy vocabulary object, in which terms are understood
* to be namespace prefixes and descriptions are the namespace URIs.
*/
-function islandora_rules_datastream_load_namespace_vocab($xpath, $xpath_vocab) {
+function islandora_rules_datastream_load_namespace_vocab(DOMXPath $xpath, $xpath_vocab) {
foreach (taxonomy_get_tree($xpath_vocab->vid, 0, 1, FALSE) as $term) {
$xpath->registerNamespace($term->name, $term->description);
}
@@ -499,7 +498,7 @@ function islandora_rules_data_info() {
* The object on which to set the property, described by $info['property'].
* @param array $options
* An array of options... Not sure how it's used? Not touched by us, in any
- * case. :P
+ * case. :P.
* @param string $name
* The name of the property to set, as used by Rules.
* @param string $type
@@ -510,7 +509,7 @@ function islandora_rules_data_info() {
* - property: A string indicate the actual property on the $data we wish to
* set.
*/
-function islandora_rules_property_get($data, array $options, $name, $type, $info) {
+function islandora_rules_property_get($data, array $options, $name, $type, array $info) {
return $data->$info['property'];
}
@@ -536,7 +535,7 @@ function islandora_rules_property_get($data, array $options, $name, $type, $info
* - property: A string indicate the actual property on the $data we wish to
* set.
*/
-function islandora_rules_property_set(&$data, $name, $value, $langcode, $type, $info) {
+function islandora_rules_property_set(&$data, $name, $value, $langcode, $type, array $info) {
$data->$info['property'] = $value;
}
diff --git a/tests/authtokens.test b/tests/authtokens.test
index 352689e2..dc2c8bce 100644
--- a/tests/authtokens.test
+++ b/tests/authtokens.test
@@ -1,10 +1,8 @@
drupalLogin($user);
// Test If-Modified-Since.
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Modified-Since: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'),
));
$this->assertResponse(304);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Modified-Since: ' . $datastream->createdDate->sub(new DateInterval('P1M'))->format('D, d M Y H:i:s \G\M\T'),
));
$this->assertResponse(200);
// Test If-Unmodified-Since.
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Unmodified-Since: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'),
));
$this->assertResponse(200);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Unmodified-Since: ' . $datastream->createdDate->sub(new DateInterval('P1M'))->format('D, d M Y H:i:s \G\M\T'),
));
$this->assertResponse(412);
// Test If-Match.
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
format_string('If-Match: "!checksum"', array(
'!checksum' => $datastream->checksum,
)),
));
$this->assertResponse(200);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
format_string('If-Match: "!checksum"', array(
'!checksum' => 'dont-match' . $datastream->checksum,
)),
@@ -121,35 +119,35 @@ class IslandoraDatastreamCacheTestCase extends IslandoraWebTestCase {
$this->assertResponse(412);
// Test If-None-Match.
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
format_string('If-None-Match: "!checksum"', array(
'!checksum' => $datastream->checksum,
)),
));
$this->assertResponse(304);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
format_string('If-None-Match: "!checksum"', array(
'!checksum' => 'dont-match' . $datastream->checksum,
)),
));
$this->assertResponse(200);
- // Test combination of If-None-Match and If-Modified-Since
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ // Test combination of If-None-Match and If-Modified-Since.
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Modified-Since: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'),
format_string('If-None-Match: "!checksum"', array(
'!checksum' => $datastream->checksum,
)),
));
$this->assertResponse(304);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Modified-Since: ' . $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'),
format_string('If-None-Match: "!checksum"', array(
'!checksum' => 'dont-match' . $datastream->checksum,
)),
));
$this->assertResponse(200);
- $result = $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
+ $this->drupalGet("islandora/object/{$object->id}/datastream/{$datastream->id}/view", array(), array(
'If-Modified-Since: ' . $datastream->createdDate->sub(new DateInterval('P1M'))->format('D, d M Y H:i:s \G\M\T'),
format_string('If-None-Match: "!checksum"', array(
'!checksum' => $datastream->checksum,
@@ -157,4 +155,5 @@ class IslandoraDatastreamCacheTestCase extends IslandoraWebTestCase {
));
$this->assertResponse(200);
}
+
}
diff --git a/tests/datastream_validator_tests.test b/tests/datastream_validator_tests.test
index 40615ae4..99679841 100644
--- a/tests/datastream_validator_tests.test
+++ b/tests/datastream_validator_tests.test
@@ -1,4 +1,5 @@
addResult(FALSE, 'boo you failed', $this->getAssertionCall());
}
+
}
/**
* Tests the ability of DatastreamValidators to produce correct results.
*/
+// @codingStandardsIgnoreLine
class DatastreamValidatorResultTestCase extends IslandoraWebTestCase {
/**
@@ -109,8 +113,8 @@ class DatastreamValidatorResultTestCase extends IslandoraWebTestCase {
$this->assertTrue(substr($first_caller['file'], -48) === substr($second_caller['file'], -48), "Fail caller file matches the pass caller file.", 'Islandora');
$this->assertTrue($first_caller['function'] === 'TestDatastreamValidator->assertSomethingSuccessfully()', "Correct pass caller function returned (actual: {$first_caller['function']}; expected: TestDatastreamValidator->assertSomethingSuccessfully()).", 'Islandora');
$this->assertTrue($second_caller['function'] === 'TestDatastreamValidator->assertSomethingFailed()', "Correct fail caller function returned (actual: {$second_caller['function']}; expected: TestDatastreamValidator->assertSomethingFailed()).", 'Islandora');
- $this->assertTrue($first_caller['line'] === 16, "Correct pass line number returned (actual: {$first_caller['line']}; expected: 16).", 'Islandora');
- $this->assertTrue($second_caller['line'] === 23, "Correct fail line number returned (actual: {$second_caller['line']}; expected: 23).", 'Islandora');
+ $this->assertTrue($first_caller['line'] === 18, "Correct pass line number returned (actual: {$first_caller['line']}; expected: 18).", 'Islandora');
+ $this->assertTrue($second_caller['line'] === 25, "Correct fail line number returned (actual: {$second_caller['line']}; expected: 25).", 'Islandora');
}
}
@@ -119,6 +123,7 @@ class DatastreamValidatorResultTestCase extends IslandoraWebTestCase {
/**
* Procedurally generated tests for DatastreamValidators.
*/
+// @codingStandardsIgnoreLine
class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase {
/**
@@ -222,7 +227,7 @@ class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase {
'dsid' => $prefix,
'path' => $this->path . $filename,
'control_group' => 'M',
- ),
+ ),
);
$object = $this->ingestConstructedObject(array(), $datastreams);
return $object;
@@ -273,4 +278,5 @@ class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase {
}
}
}
+
}
diff --git a/tests/datastream_versions.test b/tests/datastream_versions.test
index 6b22bd95..a2b6b409 100644
--- a/tests/datastream_versions.test
+++ b/tests/datastream_versions.test
@@ -1,10 +1,8 @@
drupalGet("islandora/object/{$this->pid}/datastream/DC/version/0/delete");
$this->assertResponse(404);
}
+
}
diff --git a/tests/derivatives.test b/tests/derivatives.test
index 95377a75..1b964e37 100644
--- a/tests/derivatives.test
+++ b/tests/derivatives.test
@@ -1,7 +1,6 @@
pid = $this->randomName() . ":" . $this->randomName();
}
- /**
- * Free any objects/resources created for this test.
- *
- * @see IslandoraWebTestCase::tearDown()
- */
- public function tearDown() {
- $tuque = islandora_get_tuque_connection();
- parent::tearDown();
- }
-
/**
* Tests that the islandora_islandora_object_ingested hook gets fired.
*/
@@ -156,7 +144,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
/**
* Tests derivative hook filtering based upon source_dsid.
*/
- public function testDerivativeFilteringOnSourceDSID() {
+ public function testDerivativeFilteringOnSourceDsid() {
global $_islandora_derivative_test_derivative_functions;
$_islandora_derivative_test_derivative_functions = array();
$object = $this->constructBaseObject();
@@ -182,7 +170,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
/**
* Tests that only functions were the source_dsid is NULL are fired.
*/
- public function testNULLSourceDSID() {
+ public function testNullSourceDsid() {
global $_islandora_derivative_test_derivative_functions;
$_islandora_derivative_test_derivative_functions = array();
$this->constructBaseObject();
@@ -205,7 +193,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
/**
* Tests that when no source_dsid all derivative functions are called.
*/
- public function testNoSourceDSIDNoForce() {
+ public function testNoSourceDsidNoForce() {
global $_islandora_derivative_test_derivative_functions;
$_islandora_derivative_test_derivative_functions = array();
$object = $this->constructBaseObject();
@@ -227,7 +215,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
/**
* Tests that when no source_dsid all derivative functions are called.
*/
- public function testNoSourceDSIDForce() {
+ public function testNoSourceDsidForce() {
global $_islandora_derivative_test_derivative_functions;
$_islandora_derivative_test_derivative_functions = array();
$object = $this->constructBaseObject();
@@ -290,7 +278,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
* @return AbstractObject
* The modified AbstractObject.
*/
- public function constructDERIVDatastream(AbstractObject $object) {
+ public function constructDerivDatastream(AbstractObject $object) {
$dsid = 'DERIV';
$ds = $object->constructDatastream($dsid);
$ds->label = 'Test';
@@ -308,7 +296,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
* @return AbstractObject
* The modified AbstractObject.
*/
- public function constructNOSOURCEDatastream(AbstractObject $object) {
+ public function constructNosourceDatastream(AbstractObject $object) {
$dsid = 'NOSOURCE';
$ds = $object->constructDatastream($dsid);
$ds->label = 'Test';
@@ -326,7 +314,7 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
* @return AbstractObject
* The modified AbstractObject.
*/
- public function constructSOMEWEIRDDATASTREAMDatastream(AbstractObject $object) {
+ public function constructSomeweirddatastreamDatastream(AbstractObject $object) {
$dsid = 'SOMEWEIRDDATASTREAM';
$ds = $object->constructDatastream($dsid);
$ds->label = 'Test';
@@ -334,4 +322,5 @@ class IslandoraDerivativesTestCase extends IslandoraWebTestCase {
$object->ingestDatastream($ds);
return $object;
}
+
}
diff --git a/tests/hooked_access.test b/tests/hooked_access.test
index 894eee80..632530bd 100644
--- a/tests/hooked_access.test
+++ b/tests/hooked_access.test
@@ -1,7 +1,6 @@
assertFalse(islandora_datastream_access($this->denied_op, $this->object['asdf']), 'Explicit denial of datastream access.');
}
+
}
diff --git a/tests/hooks.test b/tests/hooks.test
index 073d0349..24bf9ae8 100644
--- a/tests/hooks.test
+++ b/tests/hooks.test
@@ -1,7 +1,6 @@
assert($_SESSION['islandora_hooks']['hook'][ISLANDORA_DATASTREAM_INGESTED_HOOK], 'Called ISLANDORA_DATASTREAM_INGESTED_HOOK when ingesting via FedoraObject::ingestDatastream.');
$this->repository->purgeObject($object->id);
}
+
}
diff --git a/tests/includes/datastream_validators.inc b/tests/includes/datastream_validators.inc
index b8ff785e..5134339a 100644
--- a/tests/includes/datastream_validators.inc
+++ b/tests/includes/datastream_validators.inc
@@ -1,4 +1,5 @@
addResult(TRUE, "{$this->datastream} datastream asserts that it is a valid Intel-byte-orderded TIF/TIFF file.");
}
elseif ($datastream_header_hex == "4d4d002a") {
@@ -248,7 +252,7 @@ class TIFFDatastreamValidator extends DatastreamValidator {
* @return string
* The ... thing I just wrote up there.
*/
- protected function getTIFFHeaderHex() {
+ protected function getTiffHeaderHex() {
return substr(bin2hex($this->datastreamContent), 0, 8);
}
@@ -257,6 +261,7 @@ class TIFFDatastreamValidator extends DatastreamValidator {
/**
* Asserts the validity of a JP2 datastream.
*/
+// @codingStandardsIgnoreLine
class JP2DatastreamValidator extends DatastreamValidator {
/**
@@ -265,7 +270,7 @@ class JP2DatastreamValidator extends DatastreamValidator {
* JP2 files begin with an offset header at the second 32-bit integer,
* 0x6A502020. This header is in all .jp2s, and we check for it here.
*/
- protected function assertJP2Header() {
+ protected function assertJp2Header() {
$assertion = substr(bin2hex($this->datastreamContent), 8, 8) == '6a502020';
$pass = "Datastream {$this->datastream} contains the appropriate JP2 header.";
$fail = "Datastream {$this->datastream} does not contain the appropriate JP2 header.";
@@ -279,24 +284,26 @@ class JP2DatastreamValidator extends DatastreamValidator {
* JP2 files have their codestream capped with a marker, 0xFFD9. We're just
* checking for it here to see if the .jp2 encoder finished okay.
*/
- protected function assertJP2Marker() {
+ protected function assertJp2Marker() {
$assertion = substr(bin2hex($this->datastreamContent), strlen(bin2hex($this->datastreamContent)) - 4, 4) == 'ffd9';
$pass = "Datastream {$this->datastream} contains the appropriate JP2 ending marker.";
$fail = "Datastream {$this->datastream} does not contain the appropriate JP2 ending marker. If this is the only JP2 validator that failed, it is likely that derivative generation was interrupted.";
$message = $assertion ? $pass : $fail;
$this->addResult($assertion, $message);
}
+
}
/**
* Asserts the validity of a PDF datastream.
*/
+// @codingStandardsIgnoreLine
class PDFDatastreamValidator extends DatastreamValidator {
/**
* Validates the PDF signature.
*/
- protected function assertPDFSignature() {
+ protected function assertPdfSignature() {
$assertion = substr($this->datastreamContent, 0, 5) == '%PDF-';
$pdf_version = substr($this->datastreamContent, 5, 3);
$pass = "{$this->datastream} datastream asserts that it is a valid PDF file using PDF version {$pdf_version}";
@@ -308,7 +315,7 @@ class PDFDatastreamValidator extends DatastreamValidator {
/**
* Counts the number of signatures in this PDF file and asserts there are any.
*/
- protected function assertPDFStreamCount() {
+ protected function assertPdfStreamCount() {
$pdf_stream_count = substr_count(bin2hex($this->datastreamContent), '0a73747265616d0a');
$assertion = $pdf_stream_count !== 0;
$pass = "{$this->datastream} datastream reports the existence of {$pdf_stream_count} PDF streams. Note that an extremely low number could still indicate corruption.";
@@ -319,17 +326,15 @@ class PDFDatastreamValidator extends DatastreamValidator {
/**
* Validates the PDF closing tag.
- *
- * @return bool
- * TRUE if it was present; FALSE otherwise.
*/
- protected function assertPDFClosingTag() {
+ protected function assertPdfClosingTag() {
$assertion = strpos(bin2hex($this->datastreamContent), '0a2525454f460a') == TRUE;
$pass = "{$this->datastream} datastream reports the existence of the closing 'EOF' tag required at the end of PDFs";
$fail = "{$this->datastream} datastream does not contain the closing 'EOF' tag. If this is the only PDF validation that failed, it is likely that derivative generation was interrupted.";
$message = $assertion ? $pass : $fail;
$this->addResult($assertion, $message);
}
+
}
/**
@@ -339,7 +344,9 @@ class PDFDatastreamValidator extends DatastreamValidator {
* is the string we're looking to find in the datastream, and the second is an
* integer representing the number of times it should appear in the datastream.
*/
+// @codingStandardsIgnoreLine
class TextDatastreamValidator extends DatastreamValidator {
+
/**
* Constructor override; blow up if we don't have our two values.
*/
@@ -369,6 +376,7 @@ class TextDatastreamValidator extends DatastreamValidator {
protected function getTextStringCount() {
return substr_count($this->datastreamContent, $this->params[0]);
}
+
}
/**
@@ -381,6 +389,7 @@ class TextDatastreamValidator extends DatastreamValidator {
* declared chunk sizes against actual sizes. If any of these are off, WAV
* players will fail to function.
*/
+// @codingStandardsIgnoreLine
class WAVDatastreamValidator extends DatastreamValidator {
/**
@@ -401,7 +410,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the datastream contains a valid WAV signature.
*/
- protected function assertWAVSignature() {
+ protected function assertWavSignature() {
$signatures = str_split(substr($this->datastreamContent, 0, 24), 8);
$assertion = $signatures[0] == '52494646' && $signatures[2] == '57415645';
$pass = "Header of the {$this->datastream} datastream contains a valid file signature.";
@@ -413,7 +422,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the chunksize in the header is correct.
*/
- protected function assertWAVChunkSize() {
+ protected function assertWavChunkSize() {
$assertion = islandora_hex2int(substr($this->datastreamContent, 8, 8)) === 36 + self::getDataSubChunkSize();
$pass = "{$this->datastream} datastream chunksize in WAV header is correct";
$fail = "{$this->datastream} datastream chunksize in WAV header does not match actual chunksize.";
@@ -424,7 +433,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the datastream contains a 'fmt' subchunk.
*/
- protected function assertWAVFmtSubChunk() {
+ protected function assertWavFmtSubChunk() {
$assertion = substr($this->datastreamContent, 24, 8) === '666d7420';
$pass = "{$this->datastream} datastream contains a 'fmt' subchunk.";
$fail = "{$this->datastream} datastream is missing the required 'fmt' subchunk.";
@@ -435,7 +444,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the byterate reported by the WAV header is valid.
*/
- protected function assertWAVByteRate() {
+ protected function assertWavByteRate() {
$wav_samplerate = islandora_hex2int(substr($this->datastreamContent, 48, 8));
$assertion = islandora_hex2int(substr($this->datastreamContent, 56, 8)) === $wav_samplerate * self::getNumChannels() * self::getBytesPerSample();
$pass = "{$this->datastream} datastream byterate in the WAV header is correct.";
@@ -447,7 +456,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the block alignment is correct.
*/
- protected function assertWAVBlockAlignment() {
+ protected function assertWavBlockAlignment() {
$assertion = islandora_hex2int(substr($this->datastreamContent, 64, 4)) === self::getNumChannels() * self::getBytesPerSample();
$pass = "{$this->datastream} datastream block alignment is set correctly.";
$fail = "{$this->datastream} datastream block alignment is off.";
@@ -460,7 +469,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
*
* Also asserts that the subchunk size is correct.
*/
- protected function assertWAVDataSubChunk() {
+ protected function assertWavDataSubChunk() {
if (substr($this->datastreamContent, 72, 8) !== '64617461') {
$this->addResult(FALSE, "{$this->datastream} datastream is missing the 'data' subchunk.");
return;
@@ -505,6 +514,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
protected function getDataSubChunkSize() {
return islandora_hex2int(substr($this->datastreamContent, 80, 8));
}
+
}
/**
@@ -516,6 +526,7 @@ class WAVDatastreamValidator extends DatastreamValidator {
* VBR settings. Otherwise, we look for the basic MP3 signature 'fffa' or 'fffb'
* at the start of the binary.
*/
+// @codingStandardsIgnoreLine
class MP3DatastreamValidator extends DatastreamValidator {
/**
@@ -526,7 +537,7 @@ class MP3DatastreamValidator extends DatastreamValidator {
* breaking my own rules here and using a single assert function so that I
* can handle the weird logic.
*/
- protected function assertValidMP3() {
+ protected function assertValidMp3() {
$this->datastreamContent = bin2hex($this->datastreamContent);
// If it's not a VBR MP3, we don't have to check much, so let's get that
@@ -607,12 +618,13 @@ class MP3DatastreamValidator extends DatastreamValidator {
* a four-character filetype code. Here, we look for 'ftyp', and then pass the
* filetype code to the test message.
*/
+// @codingStandardsIgnoreLine
class MP4DatastreamValidator extends DatastreamValidator {
/**
* Asserts that the datastream is ISO-formatted video.
*/
- protected function assertISOVideo() {
+ protected function assertIsoVideo() {
$mp4_ftyp = substr(strpos($this->datastreamContent, 'ftyp'), 4, 4);
$assertion = strpos($this->datastreamContent, 'ftyp') !== 0;
$pass = "{$this->datastream} datastream asserts that it is a valid ISO-formatted video file using ftyp {$mp4_ftyp}";
@@ -620,6 +632,7 @@ class MP4DatastreamValidator extends DatastreamValidator {
$message = $assertion ? $pass : $fail;
$this->addResult($assertion, $message);
}
+
}
/**
@@ -631,12 +644,13 @@ class MP4DatastreamValidator extends DatastreamValidator {
* one OGG page, and confirming that the file asserts the Theora and Vorbis
* codecs were used to create the file.
*/
+// @codingStandardsIgnoreLine
class OGGDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the datastream contains ogg pages.
*/
- protected function assertOGGPages() {
+ protected function assertOggPages() {
$ogg_pages = substr_count($this->datastreamContent, 'OggS');
$assertion = $ogg_pages !== 0;
$pass = "{$this->datastream} datastream asserts that it contains {$ogg_pages} Ogg pages (even a very small file should contain several).";
@@ -666,6 +680,7 @@ class OGGDatastreamValidator extends DatastreamValidator {
$message = $assertion ? $pass : $fail;
$this->addResult($assertion, $message);
}
+
}
/**
@@ -678,12 +693,13 @@ class OGGDatastreamValidator extends DatastreamValidator {
* second, we know that the file will contain the declaration 'matroska' soon
* after.
*/
+// @codingStandardsIgnoreLine
class MKVDatastreamValidator extends DatastreamValidator {
/**
* Asserts that the datastream is an EBML-format file.
*/
- protected function assertEBMLFormat() {
+ protected function assertEbmlFormat() {
$assertion = substr(bin2hex($this->datastreamContent), 0, 8) == '1a45dfa3';
$pass = "{$this->datastream} datastream asserts that it is an EBML-formatted file";
$fail = "{$this->datastream} datastream is not an EBML-formatted file.";
@@ -701,4 +717,5 @@ class MKVDatastreamValidator extends DatastreamValidator {
$message = $assertion ? $pass : $fail;
$this->addResult($assertion, $message);
}
+
}
diff --git a/tests/includes/islandora_unit_test_case.inc b/tests/includes/islandora_unit_test_case.inc
index da0a8a71..9e6235d5 100644
--- a/tests/includes/islandora_unit_test_case.inc
+++ b/tests/includes/islandora_unit_test_case.inc
@@ -1,9 +1,8 @@
FALSE);
$utilities = new IslandoraTestUtilities($this->configuration, $params);
@@ -40,7 +39,7 @@ class IslandoraUnitTestCase extends DrupalUnitTestCase {
* @param IslandoraTestUtilities $utility
* An instance of IslandoraTestUtilities with populated results.
*/
- public function parseUtilityResults($utility) {
+ public function parseUtilityResults(IslandoraTestUtilities $utility) {
foreach ($utility->getResults() as $result) {
$this->assert($result->getType(), $result->getMessage(), 'Islandora', $result->getCaller());
}
diff --git a/tests/includes/islandora_web_test_case.inc b/tests/includes/islandora_web_test_case.inc
index 5e422418..308641b6 100644
--- a/tests/includes/islandora_web_test_case.inc
+++ b/tests/includes/islandora_web_test_case.inc
@@ -1,10 +1,8 @@
$this->loggedInUser,
@@ -65,7 +63,7 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
* @param IslandoraTestUtilities $utility
* An instance of IslandoraTestUtilities with populated results.
*/
- public function parseUtilityResults($utility) {
+ public function parseUtilityResults(IslandoraTestUtilities $utility) {
foreach ($utility->getResults() as $result) {
$this->assert($result->getType(), $result->getMessage(), 'Islandora', $result->getCaller());
}
@@ -253,9 +251,9 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
* Deletes an object using the PID. This does the deletion using the UI.
*
* @param string $pid
- * The PID of the collection to be deleted
+ * The PID of the collection to be deleted.
* @param string $button
- * The label of the first 'Delete' button
+ * The label of the first 'Delete' button.
* @param bool $safety
* If TRUE, this will only delete objects owned by users in $this->users.
*
@@ -284,11 +282,10 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
}
}
- /**
- * These are a few quick helper functions to fill in a gap in the standard
- * DrupalWebTestCase where no function exists to test for the simple existence
- * or non-existence of an error.
- */
+ // These are a few quick helper functions to fill in a gap in the standard
+ // DrupalWebTestCase where no function exists to test for the simple existence
+ // or non-existence of an error.
+ // @codingStandardsIgnoreLine
/**
* Asserts that an error is found in $this->content.
@@ -373,8 +370,6 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
* button labels that don't have the ID we want, so that the only one left
* with the correct label is the one with the right ID.
*
- * @see DrupalWebTestCase::drupalPost()
- *
* @param string $path
* Location of the post form.
* @param array $edit
@@ -388,15 +383,17 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
* @param array $headers
* An array containing additional HTTP request headers, each formatted as
* "name: value".
- * @param null $form_html_id
+ * @param mixed $form_html_id
* (optional) HTML ID of the form to be submitted.
- * @param null $extra_post
+ * @param mixed $extra_post
* (optional) A string of additional data to append to the POST submission.
*
* @return bool|string
* The content from the POST request's curlExec, or FALSE on fail.
+ *
+ * @see DrupalWebTestCase::drupalPost()
*/
- public function drupalPostByID($path, $edit, $submit, $id, array $options = array(), array $headers = array(), $form_html_id = NULL, $extra_post = NULL) {
+ public function drupalPostById($path, array $edit, $submit, $id, array $options = array(), array $headers = array(), $form_html_id = NULL, $extra_post = NULL) {
$buttons = $this->xpath("//input[@type=\"submit\" and @value=\"{$submit}\"]");
if (empty($buttons)) {
$this->fail("No buttons found on the page with value '$submit'");
diff --git a/tests/includes/test_utility_abstraction.inc b/tests/includes/test_utility_abstraction.inc
index aa09004b..dad96d92 100644
--- a/tests/includes/test_utility_abstraction.inc
+++ b/tests/includes/test_utility_abstraction.inc
@@ -1,4 +1,5 @@
type;
}
+
}
/**
diff --git a/tests/includes/utilities.inc b/tests/includes/utilities.inc
index eefae4cc..192c377a 100644
--- a/tests/includes/utilities.inc
+++ b/tests/includes/utilities.inc
@@ -1,6 +1,6 @@
configuration = $configuration;
$this->params = $params;
$connection = new RepositoryConnection($this->configuration['fedora_url'], $this->configuration['admin_user'], $this->configuration['admin_pass']);
@@ -111,7 +110,7 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass {
* @return bool
* TRUE on success, FALSE on fail.
*/
- public function assertDatastreams($object, array $datastreams) {
+ public function assertDatastreams(AbstractObject $object, array $datastreams) {
if (!self::assertFedoraObject($object)) {
$this->addResult(FALSE, "Failed. Object passed in is invalid.", 'Islandora');
}
@@ -136,7 +135,7 @@ class IslandoraTestUtilities extends IslandoraTestUtilityClass {
* @param array $datastreams
* An array of datastreams to confirm not present.
*/
- public function assertNoDatastreams($object, array $datastreams) {
+ public function assertNoDatastreams(AbstractObject $object, array $datastreams) {
if (!self::assertFedoraObject($object)) {
$this->addResult(FALSE, "Failed. Object passed in is invalid.", 'Islandora');
return;
diff --git a/tests/ingest.test b/tests/ingest.test
index 173b926f..2dc40c62 100644
--- a/tests/ingest.test
+++ b/tests/ingest.test
@@ -1,7 +1,6 @@
assertTrue($ret, 'User access granted for matching permissions, with a datastream given instead of an object.');
}
+
}
diff --git a/tests/islandora_manage_temp_file.test b/tests/islandora_manage_temp_file.test
index 65003ed8..4ceb5ea1 100644
--- a/tests/islandora_manage_temp_file.test
+++ b/tests/islandora_manage_temp_file.test
@@ -1,10 +1,8 @@
baseFileHelper($this->tempUri);
$this->baseFileHelper($this->publicUri);
}
+
}
diff --git a/tests/islandora_derivatives_test.info b/tests/modules/islandora_derivatives_test/islandora_derivatives_test.info
similarity index 100%
rename from tests/islandora_derivatives_test.info
rename to tests/modules/islandora_derivatives_test/islandora_derivatives_test.info
diff --git a/tests/islandora_derivatives_test.module b/tests/modules/islandora_derivatives_test/islandora_derivatives_test.module
similarity index 99%
rename from tests/islandora_derivatives_test.module
rename to tests/modules/islandora_derivatives_test/islandora_derivatives_test.module
index 91ef8fef..a703b82f 100644
--- a/tests/islandora_derivatives_test.module
+++ b/tests/modules/islandora_derivatives_test/islandora_derivatives_test.module
@@ -71,6 +71,7 @@ function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$der
* An AbstractObject representing a Fedora object.
* @param bool $force
* Whether or not derivative generation is to be forced.
+ *
* @return array
* An array detailing the success of the operation.
*
@@ -131,6 +132,7 @@ function islandora_derivatives_test_create_stanley_datastream(AbstractObject $ob
* An AbstractObject representing a Fedora object.
* @param bool $force
* Whether or not derivative generation is to be forced.
+ *
* @return array
* An array detailing the success of the operation.
*
@@ -226,13 +228,13 @@ function islandora_derivatives_test_add_datastream(AbstractObject $object, $dsid
/**
* Returns a message if we failed to add a derivative.
*
- * @see hook_islandora_derivative()
- *
* @param string $message
* The error message to be returned back.
*
* @return array
* An array describing the outcome of our failure.
+ *
+ * @see hook_islandora_derivative()
*/
function islandora_derivatives_test_failed_adding($message) {
return array(
diff --git a/tests/islandora_hooked_access_test.info b/tests/modules/islandora_hooked_access_test/islandora_hooked_access_test.info
similarity index 100%
rename from tests/islandora_hooked_access_test.info
rename to tests/modules/islandora_hooked_access_test/islandora_hooked_access_test.info
diff --git a/tests/islandora_hooked_access_test.module b/tests/modules/islandora_hooked_access_test/islandora_hooked_access_test.module
similarity index 93%
rename from tests/islandora_hooked_access_test.module
rename to tests/modules/islandora_hooked_access_test/islandora_hooked_access_test.module
index 6f5861f7..efbc29e6 100644
--- a/tests/islandora_hooked_access_test.module
+++ b/tests/modules/islandora_hooked_access_test/islandora_hooked_access_test.module
@@ -2,7 +2,7 @@
/**
* @file
- * Hook implementations tested in hooked_access.test
+ * Hook implementations tested in hooked_access.test.
*/
/**
diff --git a/tests/islandora_hooks_test.info b/tests/modules/islandora_hooks_test/islandora_hooks_test.info
similarity index 100%
rename from tests/islandora_hooks_test.info
rename to tests/modules/islandora_hooks_test/islandora_hooks_test.info
diff --git a/tests/islandora_hooks_test.module b/tests/modules/islandora_hooks_test/islandora_hooks_test.module
similarity index 98%
rename from tests/islandora_hooks_test.module
rename to tests/modules/islandora_hooks_test/islandora_hooks_test.module
index d602cbfd..fc81efcc 100644
--- a/tests/islandora_hooks_test.module
+++ b/tests/modules/islandora_hooks_test/islandora_hooks_test.module
@@ -2,7 +2,7 @@
/**
* @file
- * Implements hooks that get tested by islandora_hooks.test
+ * Implements hooks that get tested by islandora_hooks.test.
*/
/**
diff --git a/tests/islandora_ingest_test.info b/tests/modules/islandora_ingest_test/islandora_ingest_test.info
similarity index 100%
rename from tests/islandora_ingest_test.info
rename to tests/modules/islandora_ingest_test/islandora_ingest_test.info
diff --git a/tests/islandora_ingest_test.module b/tests/modules/islandora_ingest_test/islandora_ingest_test.module
similarity index 97%
rename from tests/islandora_ingest_test.module
rename to tests/modules/islandora_ingest_test/islandora_ingest_test.module
index 8a6771d9..412c9a27 100644
--- a/tests/islandora_ingest_test.module
+++ b/tests/modules/islandora_ingest_test/islandora_ingest_test.module
@@ -2,7 +2,7 @@
/**
* @file
- * Implements hooks that get tested by islandora_hooks.test
+ * Implements hooks that get tested by islandora_hooks.test.
*/
/**
@@ -14,6 +14,7 @@ function islandora_ingest_test_menu() {
'title' => 'Ingest Form',
'page callback' => 'islandora_ingest_test_ingest',
'type' => MENU_LOCAL_ACTION,
+ // No access restriction because its a test module.
'access callback' => TRUE,
),
);
diff --git a/tests/scripts/phpcs_setup.sh b/tests/scripts/phpcs_setup.sh
new file mode 100755
index 00000000..84b3fe41
--- /dev/null
+++ b/tests/scripts/phpcs_setup.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Setup phpcs and drupal sniffs.
+mkdir $TOOLS_DIR
+cd $TOOLS_DIR
+composer require drupal/coder
+composer require dealerdirect/phpcodesniffer-composer-installer
+$TOOLS_DIR/vendor/bin/phpcs -i
+$TOOLS_DIR/vendor/bin/phpcs --version
diff --git a/theme/islandora-dublin-core-description.tpl.php b/theme/islandora-dublin-core-description.tpl.php
index 2ff54cdc..3150b7e7 100644
--- a/theme/islandora-dublin-core-description.tpl.php
+++ b/theme/islandora-dublin-core-description.tpl.php
@@ -1,4 +1,5 @@