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..037fd14f 100644 --- a/includes/add_datastream.form.inc +++ b/includes/add_datastream.form.inc @@ -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..1ee5d289 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', @@ -225,17 +226,21 @@ 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 .= 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 .= 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 .= 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..055e6464 100644 --- a/includes/authtokens.inc +++ b/includes/authtokens.inc @@ -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 @@ $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 +226,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 +238,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 +275,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 +333,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 +366,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 9d736982..efc3b0e5 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 @@ 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 +152,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..f4e530b3 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(); @@ -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 @@ -1004,7 +1006,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 +1024,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..9ba00829 100644 --- a/includes/mime_detect.inc +++ b/includes/mime_detect.inc @@ -21,50 +21,85 @@ * http://api.drupal.org/api/function/file_default_mimetype_mapping/7 */ +/** + * Class for doing mapping to mimetypes. + */ 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 +122,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 +206,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 +242,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 +299,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..a35d47f2 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,7 @@ class IslandoraObjectEntityController implements DrupalEntityControllerInterface * @return array * An array of loaded objects. */ - public function load($ids = array(), $conditions = array()) { + public function load(array $ids = array(), array $conditions = array()) { if (!empty($conditions)) { // TODO: Allow loading by specifying IDs in the condition. throw new Exception('Conditions not implemented.'); @@ -54,4 +57,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..33016d86 100644 --- a/includes/object_properties.form.inc +++ b/includes/object_properties.form.inc @@ -90,7 +90,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')), @@ -200,15 +201,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..c5c4dff0 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -105,7 +105,7 @@ 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. @@ -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; } @@ -405,8 +407,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 +424,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 +537,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 +629,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 +682,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 +719,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 +731,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 +765,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 +776,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 +805,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 +836,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..9cecc1d8 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,7 +64,7 @@ class IslandoraTuque { /** * Constructor. * - * @param array $user + * @param object $user * A Drupal user. * @param string $url * The url to the fedora instance. @@ -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: @pid
code: @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: @pid
code: @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 @pid
code: @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 @pid
code: @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 @pid
code: @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..b4e93a6a 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)) { @@ -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..aa344850 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']); diff --git a/islandora.module b/islandora.module index 0efc7cc4..b0f7abf5 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( @@ -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__); @@ -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()) { @@ -898,7 +900,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. @@ -909,7 +911,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()) { @@ -1124,7 +1126,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)); } @@ -1140,7 +1142,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'); @@ -1164,7 +1166,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)); } @@ -1261,7 +1264,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) { @@ -1288,7 +1291,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]. * @@ -1297,7 +1300,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]); } @@ -1313,7 +1316,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() @@ -1349,7 +1351,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]) { @@ -1484,15 +1486,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; @@ -1625,7 +1627,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'); @@ -1652,7 +1654,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. @@ -1994,7 +1996,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 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 @@ assertResponse(200); - // Test combination of If-None-Match and If-Modified-Since + // Test combination of If-None-Match and If-Modified-Since. $result = $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( @@ -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..d01ab1d5 100644 --- a/tests/datastream_validator_tests.test +++ b/tests/datastream_validator_tests.test @@ -1,4 +1,5 @@ addResult(FALSE, 'boo you failed', $this->getAssertionCall()); } + } /** @@ -222,7 +224,7 @@ class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase { 'dsid' => $prefix, 'path' => $this->path . $filename, 'control_group' => 'M', - ), + ), ); $object = $this->ingestConstructedObject(array(), $datastreams); return $object; @@ -273,4 +275,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..e5bee0e5 100644 --- a/tests/derivatives.test +++ b/tests/derivatives.test @@ -1,7 +1,6 @@ constructBaseObject(); @@ -182,7 +180,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 +203,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 +225,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 +288,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 +306,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 +324,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 +332,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..284519f0 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 +249,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); } @@ -265,7 +266,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,13 +280,14 @@ 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); } + } /** @@ -296,7 +298,7 @@ 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 +310,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 +321,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); } + } /** @@ -340,6 +340,7 @@ class PDFDatastreamValidator extends DatastreamValidator { * integer representing the number of times it should appear in the datastream. */ class TextDatastreamValidator extends DatastreamValidator { + /** * Constructor override; blow up if we don't have our two values. */ @@ -369,6 +370,7 @@ class TextDatastreamValidator extends DatastreamValidator { protected function getTextStringCount() { return substr_count($this->datastreamContent, $this->params[0]); } + } /** @@ -401,7 +403,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 +415,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 +426,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 +437,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 +449,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 +462,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 +507,7 @@ class WAVDatastreamValidator extends DatastreamValidator { protected function getDataSubChunkSize() { return islandora_hex2int(substr($this->datastreamContent, 80, 8)); } + } /** @@ -526,7 +529,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 @@ -612,7 +615,7 @@ 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 +623,7 @@ class MP4DatastreamValidator extends DatastreamValidator { $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -636,7 +640,7 @@ 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 +670,7 @@ class OGGDatastreamValidator extends DatastreamValidator { $message = $assertion ? $pass : $fail; $this->addResult($assertion, $message); } + } /** @@ -683,7 +688,7 @@ 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 +706,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/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 @@
> diff --git a/theme/islandora-object-edit.tpl.php b/theme/islandora-object-edit.tpl.php index ea9cec64..a14bcb01 100644 --- a/theme/islandora-object-edit.tpl.php +++ b/theme/islandora-object-edit.tpl.php @@ -4,11 +4,11 @@ * @file * The default manage datastreams view for objects. * - * islandora_object is a fedora tuque Object + * Islandora_object is a fedora tuque Object * $object->label * $object->id * to get the contents of a datastream - * $object['dsid']->content + * $object['dsid']->content. * * $dublin_core is a DublinCore object * which is an array of elements, such as dc.title diff --git a/theme/islandora-object-print.tpl.php b/theme/islandora-object-print.tpl.php index 53fdc529..0f24cc61 100644 --- a/theme/islandora-object-print.tpl.php +++ b/theme/islandora-object-print.tpl.php @@ -3,7 +3,6 @@ /** * @file * The default view to print objects. - * */ ?>
diff --git a/theme/islandora-object.tpl.php b/theme/islandora-object.tpl.php index f91c3272..e8da8449 100644 --- a/theme/islandora-object.tpl.php +++ b/theme/islandora-object.tpl.php @@ -86,11 +86,31 @@ $value): ?> - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/theme/islandora-objects.tpl.php b/theme/islandora-objects.tpl.php index f1893ef6..837752ce 100644 --- a/theme/islandora-objects.tpl.php +++ b/theme/islandora-objects.tpl.php @@ -7,11 +7,11 @@ ?>
- $display_links, - 'attributes' => array('class' => array('links', 'inline')), - ) + 'links' => $display_links, + 'attributes' => array('class' => array('links', 'inline')), + ) ); ?> diff --git a/theme/theme.inc b/theme/theme.inc index c2879af8..2748bcd4 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -168,7 +168,7 @@ function template_preprocess_islandora_default(&$variables) { */ function template_preprocess_islandora_object_print(array &$variables) { // Apply the print CSS in non print context. - $only_print_media = function($o) { + $only_print_media = function ($o) { return $o['media'] == 'print'; }; $css = array_filter(drupal_add_css(), $only_print_media); @@ -313,8 +313,6 @@ function islandora_objects_object_mapper($object_id) { * * A variant of "islandora_objects" which accepts a subset of object to theme. * - * @see template_preprocess_islandora_objects() - * * @param array $variables * An associative array containing: * - objects: An array of PIDs to render for the given page. @@ -333,8 +331,10 @@ function islandora_objects_object_mapper($object_id) { * be toggled between a "grid" and "list" view. * - pager: A renderable array for the pager. * - content: A renderable array for the main content of the page. + * + * @see template_preprocess_islandora_objects() */ -function template_preprocess_islandora_objects_subset(&$variables) { +function template_preprocess_islandora_objects_subset(array &$variables) { $display = (empty($_GET['display'])) ? $variables['display'] : $_GET['display']; $grid_display = $display == 'grid'; $list_display = !$grid_display;