diff --git a/CollectionClass.inc b/CollectionClass.inc index c90a5e89..78e9e857 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -2,7 +2,8 @@ -/* +/** + * @file * Created on 18-Feb-08 * * To change the template for this generated file go to @@ -284,7 +285,7 @@ class CollectionClass { $thisClass = new $phpClass (); $returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext); if (!$returnValue) { - drupal_set_message('Error! Failed running content model method !m !rv', array('!m' => $phpMethod, '!rv' => $returnValue)); + drupal_set_message(t('Error! Failed running content model method !m !rv'), array('!m' => $phpMethod, '!rv' => $returnValue)); return FALSE; } } @@ -393,7 +394,7 @@ class CollectionClass { module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); $personalCollectionClass = new PersonalCollectionClass(); if (!$personalCollectionClass->createCollection($user, $pid, $soapClient)) { - drupal_set_message("Did not create a personal collection object for !u", array('!u' => $user->name)); + drupal_set_message(t("Did not create a personal collection object for !u"), array('!u' => $user->name)); return FALSE; //creation failed don't save the collection pid in drupal db } user_save($user, $personal_collection_pid); diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index 21002710..f102933b 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -1,6 +1,9 @@ validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model'); $namespace = FALSE; for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) { @@ -568,7 +571,7 @@ class CollectionPolicy extends XMLDatastream { function addModel($cm, $namespace) { $ret = FALSE; - if (self::validPid($namespace) && $this->validate() && $cm->validate()) { + if (self::valid_pid($namespace) && $this->validate() && $cm->validate()) { $contentmodelsEl = $this->xml->getElementsByTagName('content_models'); $models = $contentmodelsEl->item(0)->getElementsByTagName('content_model'); $found = FALSE; diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index 1de4cd01..9077d998 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -3,6 +3,7 @@ /* + * @file * Created on Jan 24, 2008 * * To change the template for this generated file go to diff --git a/ContentModel.inc b/ContentModel.inc index e4b112e0..c41540a6 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -1,6 +1,9 @@ get_datastream_dissemination($dsid); if (!empty($ds)) { $ret = new ContentModel($ds, $pid, $dsid, $pid_namespace, $name); @@ -468,7 +471,7 @@ class ContentModel extends XMLDatastream { */ private function getDSModel($dsid) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $result = $this->xml->getElementsByTagName('datastreams'); if ($result->length > 0) { $result = $result->item(0)->getElementsByTagName('datastream'); @@ -579,23 +582,23 @@ class ContentModel extends XMLDatastream { $elementsEl = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); $elements = $elementsEl->getElementsByTagName('element'); $found = FALSE; - $refEl = FALSE; + $ref_el = FALSE; for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { if ($elements->item($i)->getAttribute('name') == trim($name)) { if ($reorder == 'inc') { $found = $elements->item($i); - $refEl = ($i > 0) ? $elements->item($i - 1) : false; + $ref_el = ($i > 0) ? $elements->item($i - 1) : FALSE; } else { $found = ($i + 1 < $elements->length) ? $elements->item($i + 1) : FALSE; - $refEl = $elements->item($i); + $ref_el = $elements->item($i); } } } if ($found !== FALSE) { $elementsEl->removeChild($found); - $elementsEl->insertBefore($found, $refEl); + $elementsEl->insertBefore($found, $ref_el); $ret = TRUE; } } @@ -867,23 +870,23 @@ class ContentModel extends XMLDatastream { $items = $authListEl->getElementsByTagName('item'); $found = FALSE; - $refEl = FALSE; + $ref_el = FALSE; for ($i = 0; $found === FALSE && $i < $items->length; $i++) { if ($items->item($i)->nodeValue == $value) { if ($reorder == 'inc') { - $refEl = ($i > 0) ? $items->item($i - 1) : FALSE; + $ref_el = ($i > 0) ? $items->item($i - 1) : FALSE; $found = $items->item($i); } else { - $refEl = $items->item($i); + $ref_el = $items->item($i); $found = ($i + 1 < $items->length) ? $items->item($i + 1) : FALSE; } } } - if ($found !== FALSE && $refEl !== FALSE) { + if ($found !== FALSE && $ref_el !== FALSE) { $authListEl->removeChild($found); - $authListEl->insertBefore($found, $refEl); + $authListEl->insertBefore($found, $ref_el); $ret = TRUE; } } @@ -1077,7 +1080,7 @@ class ContentModel extends XMLDatastream { */ public function buildEditMetadataForm($pid, $dsid) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $method = $this->xml->getElementsByTagName('edit_metadata_method'); if ($method->length > 0 && $method->item(0)->getAttribute('dsid') == $dsid) { $method = $method->item(0); @@ -1210,7 +1213,7 @@ class ContentModel extends XMLDatastream { */ public function updateEditMetadataMethod($module, $file, $class, $method, $handler, $dsid) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $methodEl = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); if ($methodEl->length > 0) { $methodEl = $methodEl->item(0); @@ -1240,7 +1243,7 @@ class ContentModel extends XMLDatastream { */ public function execAddDatastreamMethods($dsid, $file) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate() && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && $this->validate() && ($ds = $this->getDSModel($dsid)) !== FALSE) { $addMethod = $ds->getElementsByTagName('add_datastream_method'); if ($addMethod->length > 0) { $addMethod = $addMethod->item(0); @@ -1567,7 +1570,7 @@ class ContentModel extends XMLDatastream { public function addDs($dsid, $display_in_fieldset = FALSE) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) === FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) === FALSE) { $datastreamsEl = $this->xml->getElementsByTagName('datastreams'); if ($datastreamsEl->length > 0) { $datastreamsEl = $datastreamsEl->item(0); @@ -1591,7 +1594,7 @@ class ContentModel extends XMLDatastream { public function removeDs($dsid) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { $datastreamsEl = $this->xml->getElementsByTagName('datastreams')->item(0); $datastreamsEl->removeChild($ds); $ret = TRUE; @@ -1601,7 +1604,7 @@ class ContentModel extends XMLDatastream { public function displayInFieldset($dsid) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { $ret = strtolower($ds->getAttribute('display_in_fieldset')) == 'true'; } return $ret; @@ -1609,7 +1612,7 @@ class ContentModel extends XMLDatastream { public function setDisplayInFieldset($dsid, $value = TRUE) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { if ($value == FALSE && $ds->attributes->getNamedItem('display_in_fieldset') !== NULL) { $ds->removeAttribute('display_in_fieldset'); $ret = TRUE; @@ -1625,7 +1628,7 @@ class ContentModel extends XMLDatastream { public function setDefaultDispMeth($dsid, $module, $file, $class, $method) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { @@ -1654,7 +1657,7 @@ class ContentModel extends XMLDatastream { public function removeDispMeth($dsid, $module, $file, $class, $method) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { @@ -1676,7 +1679,7 @@ class ContentModel extends XMLDatastream { public function addDispMeth($dsid, $module, $file, $class, $method, $default = FALSE) { $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { $dispMethEl = $this->xml->createElement('display_method'); $dispMethEl->setAttribute('module', $module); $dispMethEl->setAttribute('file', $file); @@ -1757,7 +1760,7 @@ class ContentModel extends XMLDatastream { public function addIngestMethod($rule_id, $module, $file, $class, $method, $dsid, $modified_files_ext) { $ret = FALSE; - if (self::validDsid($dsid) && ($rule = $this->getIngestRule($rule_id)) !== FALSE) { + if (self::valid_dsid($dsid) && ($rule = $this->getIngestRule($rule_id)) !== FALSE) { $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); $meth = $this->xml->createElement('ingest_method'); $meth->setAttribute('module', $module); @@ -1883,7 +1886,7 @@ class ContentModel extends XMLDatastream { public function addIngestRule($applies_to, $module, $file, $class, $method, $dsid, $modified_files_ext) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $ingestRulesEl = $this->xml->getElementsByTagName('ingest_rules')->item(0); $rule = $this->xml->createElement('rule'); $ingestMethodsEl = $this->xml->createElement('ingest_methods'); @@ -1949,7 +1952,7 @@ class ContentModel extends XMLDatastream { public function editIngestFormAttributes($dsid, $page, $hide_file_chooser = FALSE, $redirect = TRUE) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + if (self::valid_dsid($dsid) && $this->validate()) { $ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0); $ingest_formEl->setAttribute('dsid', $dsid); $ingest_formEl->setAttribute('page', $page); diff --git a/MimeClass.inc b/MimeClass.inc index 7d2ae33e..bf944ee2 100644 --- a/MimeClass.inc +++ b/MimeClass.inc @@ -3,7 +3,7 @@ /** - * + * @file * This class inspired by Chris Jean's work, here: * http://chrisjean.com/2009/02/14/generating-mime-type-in-php-is-not-magic/ * diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 4f5044eb..7eafac82 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -3,8 +3,8 @@ /* + * @file * Created on Feb 1, 2008 - * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ @@ -48,7 +48,7 @@ class ObjectHelper { } $headers = module_invoke_all('file_download', "/fedora/repository/$pid/$dsID"); if (in_array(-1, $headers)) { - drupal_set_message('hello'); + drupal_set_message(t('hello')); drupal_access_denied(); return ' '; @@ -346,7 +346,7 @@ class ObjectHelper { $input = new DomDocument(); $input->loadXML(trim($xmlstr)); } catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Problem loading XSL file: !e", array('!e' => $e)), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Problem loading XSL file: !e", array('!e' => $e), NULL, WATCHDOG_ERROR); } $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); @@ -521,7 +521,7 @@ class ObjectHelper { try { $sxml = new SimpleXMLElement($content_models); } catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Could not find a parent object for %s", $pid), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Could not find a parent object for %s", $pid, NULL, WATCHDOG_ERROR); return $pids; } @@ -632,7 +632,7 @@ class ObjectHelper { // $ingestObject = ' $collectionName, '!collection_pid' => $collection_pid)) . '" href="' . base_path() . 'fedora/ingestObject/' . $collection_pid . '/' . $collectionName . '">' . t('Add a New Object') . '' . t(' Add to this Collection'); + '/images/ingest.png" alt="' . t('Add a New Object') . '" class="icon"> ' . t('Add to this Collection'); } } } @@ -715,7 +715,7 @@ class ObjectHelper { $parent_collections_HTML .= '' . $collection_label . '
'; } if (!empty($parent_collections_HTML)) { - $parent_collections_HTML = '

' . t("Belongs to these collections: ") . '

' . $parent_collections_HTML . ''; + $parent_collections_HTML = '

' . t("Belongs to these collections:") . '

' . $parent_collections_HTML . ''; } return $parent_collections_HTML; @@ -899,8 +899,8 @@ class ObjectHelper { $warnMess = "Creation of one or more datastreams failed.
"; $configMess = "Please ensure that %app is installed and configured for this site. "; - drupal_set_message($warnMess, 'warning', false); - drupal_set_message(t($configMess . "
" . $messMap[$app] . "
", array('%app' => $app)), 'warning', false); + drupal_set_message($warnMess, 'warning', FALSE); + drupal_set_message(t($configMess . "
" . $messMap[$app] . "
", array('%app' => $app)), 'warning', FALSE); } } diff --git a/SearchClass.inc b/SearchClass.inc index ef62ce91..84614145 100644 --- a/SearchClass.inc +++ b/SearchClass.inc @@ -1,6 +1,9 @@ $e->getMessage())), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Error getting solr search results class: !message", array('!message' => $e->getMessage()), NULL, WATCHDOG_ERROR); return 'Error getting solr search results class. Check watchdog for more info.'; } return $implementation->$solrFunction($query, $startPage, $fq, $dismax); @@ -363,7 +366,7 @@ class SearchClass { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t('Error loading results xslt! ') . $e->getMessage()); + drupal_set_message(t('Error loading results xslt!') . " " . $e->getMessage()); return ' '; } diff --git a/SecurityClass.inc b/SecurityClass.inc index 37a1a90c..c871895f 100644 --- a/SecurityClass.inc +++ b/SecurityClass.inc @@ -3,8 +3,8 @@ /* + * @file * Created on 22-Oct-08 - * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ @@ -58,7 +58,7 @@ class SecurityClass { try { $xml = new SimpleXMLElement($policyStream); } catch (Exception $e) { - watchdog(t("Fedora_Repository"), t("No roles found in security policy, could not parse policy stream."), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "No roles found in security policy, could not parse policy stream.", NULL, WATCHDOG_ERROR); //we may not want to send this to the screen. drupal_set_message(t('No roles found in security policy, could not parse policy stream: !message', array('!message' => $e->getMessage())), 'error'); return NULL; @@ -104,7 +104,7 @@ class SecurityClass { try { $doc->load(drupal_get_path('module', 'Fedora_Repository') . '/policies/noObjectEditPolicy.xml'); } catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Problem loading policy file."), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Problem loading policy file.", NULL, WATCHDOG_ERROR); } $conditions = $doc->getElementsByTagName('Condition'); foreach ($conditions as $condition) { diff --git a/XMLDatastream.inc b/XMLDatastream.inc index c012be8a..d4c2d55d 100644 --- a/XMLDatastream.inc +++ b/XMLDatastream.inc @@ -1,6 +1,9 @@ registerNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); - $descNode = $xpath->query("//rdf:RDF/rdf:Description")->item(0); + $desc_node = $xpath->query("//rdf:RDF/rdf:Description")->item(0); - if ($model = $descNode->getElementsByTagName('hasModel')->item(0)) { - $descNode->removeChild($model); + if ($model = $desc_node->getElementsByTagName('hasModel')->item(0)) { + $desc_node->removeChild($model); } - if ($member = $descNode->getElementsByTagName('rel:isMemberOfCollection')->item(0)) { - $descNode->removeChild($member); + if ($member = $desc_node->getElementsByTagName('rel:isMemberOfCollection')->item(0)) { + $desc_node->removeChild($member); } } @@ -95,24 +98,24 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re // Update datastream uris $xpath->registerNamespace('foxml', 'info:fedora/fedora-system:def/foxml#'); - foreach ($xpath->query("//foxml:datastream[@ID]") as $dsNode) { + foreach ($xpath->query("//foxml:datastream[@ID]") as $ds_node) { // Don't update datastreams having external uris - if (in_array($dsNode->getAttribute('CONTROL_GROUP'), $disallowed_groups)) { + if (in_array($ds_node->getAttribute('CONTROL_GROUP'), $disallowed_groups)) { continue; } - $dsId = $dsNode->getAttribute('ID'); + $ds_id = $ds_node->getAttribute('ID'); // Remove QUERY datastream - if ($dsId == "QUERY") { - $parentNode = $xpath->query('/foxml:digitalObject')->item(0); - $parentNode->removeChild($dsNode); + if ($ds_id == "QUERY") { + $parent_node = $xpath->query('/foxml:digitalObject')->item(0); + $parent_node->removeChild($ds_node); } - foreach ($dsNode->getElementsByTagName('*') as $contentNode) { - if ($str = $contentNode->getAttribute('REF')) { - $contentNode->setAttribute('REF', url($paths[$dsId], array('absolute' => TRUE))); + foreach ($ds_node->getElementsByTagName('*') as $content_node) { + if ($str = $content_node->getAttribute('REF')) { + $content_node->setAttribute('REF', url($paths[$ds_id], array('absolute' => TRUE))); } } } @@ -122,29 +125,29 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re case METS_11: // Update datastream uris $xpath->registerNamespace('METS', 'http://www.loc.gov/METS/'); - foreach ($xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]/METS:fileGrp') as $dsNode) { + foreach ($xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]/METS:fileGrp') as $ds_node) { - $dsId = $dsNode->getAttribute('ID'); + $ds_id = $ds_node->getAttribute('ID'); // Remove QUERY datastream - if ($dsId == "QUERY") { - $parentNode = $xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]')->item(0); - $parentNode->removeChild($dsNode); + if ($ds_id == "QUERY") { + $parent_node = $xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]')->item(0); + $parent_node->removeChild($ds_node); } $xpath->registerNamespace('xlink', 'http://www.loc.gov/METS/'); - foreach ($xpath->query('METS:file[@OWNERID!="E"][@OWNERID!="R"]/METS:FLocat[@xlink:href]', $dsNode) as $Floc) { - $Floc->setAttribute('xlink:href', url($paths[$dsId], array('absolute' => TRUE))); + foreach ($xpath->query('METS:file[@OWNERID!="E"][@OWNERID!="R"]/METS:FLocat[@xlink:href]', $ds_node) as $floc) { + $floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => TRUE))); } /* - foreach ($dsNode->getElementsByTagName('METS:file') as $contentNode) { + foreach ($ds_node->getElementsByTagName('METS:file') as $content_node) { // Don't update datastreams having external uris - if (in_array($dsNode->getAttribute('OWNERID'), $disallowed_groups)) { + if (in_array($ds_node->getAttribute('OWNERID'), $disallowed_groups)) { continue; } - foreach ($xpath->('METS:FLocat[@xlink:href]', $contentNode) as $Floc) { - $Floc->setAttribute('xlink:href', url($paths[$dsId], array('absolute' => true))); + foreach ($xpath->('METS:FLocat[@xlink:href]', $content_node) as $floc) { + $floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => true))); } `} */ @@ -170,8 +173,8 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re return TRUE; } -function get_file_extension($mimeType) { - return substr(strstr($mimeType, '/'), 1); +function get_file_extension($mime_type) { + return substr(strstr($mime_type, '/'), 1); } function log_line($msg, $severity = 'info', $sep = "\t") { diff --git a/api/fedora_item.inc b/api/fedora_item.inc index ef07e4de..81ef669b 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1,6 +1,10 @@ get_datastream_dissemination('RELS-EXT'); } catch (exception $e) { - drupal_set_message("Error retrieving RELS-EXT of object $pid", 'error'); + drupal_set_message(t("Error retrieving RELS-EXT of object $pid"), 'error'); return $relationships; } @@ -516,7 +520,7 @@ class Fedora_Item { foreach ($relationships as $rel) { if (empty($rel['subject']) || empty($rel['predicate']) || empty($rel['object']) || $rel['subject'] != 'info:fedora/' . $this->pid) { // drupal_set_message should use parameterized variables, not interpolated. - drupal_set_message("Error with relationship format: " . $rel['subject'] . " - " . $rel['predicate'] . ' - ' . $rel['object'], "error"); + drupal_set_message(t("Error with relationship format: " . $rel['subject'] . " - " . $rel['predicate'] . ' - ' . $rel['object']), "error"); return FALSE; } } @@ -683,7 +687,7 @@ class Fedora_Item { $result = $soap_client->__soapCall($function_name, array('parameters' => $params_array)); } else { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to get SOAP client connection.")); + watchdog(t("FEDORA_REPOSITORY"), "Error trying to get SOAP client connection."); return NULL; } } catch (exception $e) { @@ -696,7 +700,7 @@ class Fedora_Item { drupal_set_message(t("Error trying to call SOAP function $function_name. Check watchdog logs for more information."), 'error'); } - watchdog(t("FEDORA_REPOSITORY"), t("Error Trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e)), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), "Error Trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR); } return NULL; } @@ -709,13 +713,13 @@ class Fedora_Item { $result = $soap_client->__soapCall($function_name, array('parameters' => $params_array)); } else { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to get SOAP client connection.")); + watchdog(t("FEDORA_REPOSITORY"), "Error trying to get SOAP client connection."); return NULL; } } catch (exception $e) { if (!$quiet) { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e)), NULL, WATCHDOG_ERROR); + watchdog(t("FEDORA_REPOSITORY"), "Error trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR); } return NULL; } diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index 2ca9f6a4..f3362fb0 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -87,7 +87,7 @@ function fix_encoding($in_str) { } } -function validPid($pid) { +function valid_pid($pid) { $valid = FALSE; if (strlen(trim($pid)) <= 64 && preg_match('/^([A-Za-z0-9]|-|\.)+:(([A-Za-z0-9])|-|\.|~|_|(%[0-9A-F]{2}))+$/', trim($pid))) { $valid = TRUE; @@ -96,7 +96,7 @@ function validPid($pid) { return $valid; } -function validDsid($dsid) { +function valid_dsid($dsid) { $valid = FALSE; if (strlen(trim($dsid)) <= 64 && preg_match('/^[a-zA-Z0-9\_\-\.]+$/', trim($dsid))) { $valid = TRUE; @@ -105,7 +105,7 @@ function validDsid($dsid) { return $valid; } -function fixDsid($dsid) { +function fix_dsid($dsid) { $new_dsid = trim($dsid); $find = '/[^a-zA-Z0-9\.\_\-]/'; diff --git a/api/rels-ext.inc b/api/rels-ext.inc index 578a8760..de55c07f 100644 --- a/api/rels-ext.inc +++ b/api/rels-ext.inc @@ -2,7 +2,8 @@ -/* +/** + * @file * To change this template, choose Tools | Templates * and open the template in the editor. */ diff --git a/api/tagging.inc b/api/tagging.inc index da66e4db..a22caf76 100644 --- a/api/tagging.inc +++ b/api/tagging.inc @@ -62,7 +62,7 @@ class TagSet { $this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X'); } } catch (exception $e) { - drupal_set_message('There was an error saving the tags datastream: !e', array('!e' => $e), 'error'); + drupal_set_message(t('There was an error saving the tags datastream: !e'), array('!e' => $e), 'error'); return FALSE; } return TRUE; diff --git a/fedora_repository.module b/fedora_repository.module index f3ece0ad..bc4b69c3 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -94,8 +94,8 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label return ''; } - if (!validPid($collection_pid)) { - if (validPid(urldecode($collection_pid))) { + if (!valid_pid($collection_pid)) { + if (valid_pid(urldecode($collection_pid))) { $collection_pid = urldecode($collection_pid); } else { @@ -275,7 +275,7 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NUL function add_stream($collection_pid=NULL, $collectionName=NULL) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!validPid($collection_pid)) { + if (!valid_pid($collection_pid)) { drupal_set_message(t("This PID is not valid!"), 'error'); return ' '; } @@ -680,12 +680,12 @@ function fedora_repository_access($op, $node, $account) { */ function makeObject($pid, $dsID) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!validPid($pid)) { + if (!valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; } - if (!validDsid($dsID)) { + if (!valid_dsid($dsID)) { drupal_set_message(t("Invalid dsID!"), 'error'); return ' '; } @@ -724,13 +724,13 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU return ''; } - if ($pid & !validPid($pid)) { + if ($pid & !valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; } - if ($dsId & !validDsid($dsId)) { + if ($dsId & !valid_dsid($dsId)) { drupal_set_message(t("Invalid dsID!"), 'error'); return ' '; } @@ -1964,7 +1964,7 @@ function fedora_repository_batch_reingest_object($object, &$context) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!empty($object) && is_array($object)) { $pid = $object['pid']; - if (!validPid($pid)) { + if (!valid_pid($pid)) { return NULL; } // Does the object exist? If so, purge it. diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index 28106517..de4ce137 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -1,6 +1,7 @@ __soapCall('ModifyDatastreamByValue', array($params)); } catch (exception $e) { - drupal_set_message(t("Error updating metadata ") . $e->getMessage(), 'error'); + drupal_set_message(t("Error updating metadata") . " " . $e->getMessage(), 'error'); } } @@ -512,7 +513,7 @@ class formClass { '#title' => t('Content models available'), '#options' => $modelsForForm, //'#description' => t('Content models available in this collection. A content model defines what is allowed in a collection and what to do with a file when it is uploaded (An example may creating a thumbnail from an image.).') - '#description' => t('Content models define datastream composition, relationships between this and other content models, and the mandatory behaviors associated with each digital object.
Additional information may be found here. ') + '#description' => t('Content models define datastream composition, relationships between this and other content models, and the mandatory behaviors associated with each digital object.
Additional information may be found here.') ); break; diff --git a/form_elements/includes/autocomplete.inc b/form_elements/includes/autocomplete.inc index 30b887a6..6a12ba58 100644 --- a/form_elements/includes/autocomplete.inc +++ b/form_elements/includes/autocomplete.inc @@ -1,6 +1,9 @@ escape($string); $query = 'name_personal_t:' . $string . '* OR name_organization_t:' . $string . '* OR name_conference_t:' . $string . '*'; - $additionalParams = array( + $additional_params = array( 'facet' => 'false', - 'qt' => $requestHandler, + 'qt' => $request_handler, ); try { - $results = $solr->search($query, 0, 10, $additionalParams); + $results = $solr->search($query, 0, 10, $additional_params); } catch (Exception $e) { - drupal_set_message(t('error searching ') . $e->getMessage()); + drupal_set_message(t('error searching') ." " . $e->getMessage()); } if (empty($results)) { drupal_set_message(t('Error searching solr index. Is the solr search block configured properly?'), 'error'); @@ -41,15 +44,15 @@ function ife_autocomplete_person($string) { $mods = $item->get_datastream_dissemination('MODS'); if (trim($mods) != '') { - $modsDom = new DomDocument(); - $modsDom->loadXML($mods); + $mods_dom = new DomDocument(); + $mods_dom->loadXML($mods); - $xpath = new DOMXPath($modsDom); + $xpath = new DOMXPath($mods_dom); $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions(); // echo $mods; - $nodeList = $xpath->evaluate('/mods:mods/mods:name'); - foreach ($nodeList as $node) { + $node_list = $xpath->evaluate('/mods:mods/mods:name'); + foreach ($node_list as $node) { $type = $node->getAttribute('type'); $title = NULL; @@ -57,8 +60,8 @@ function ife_autocomplete_person($string) { $given = NULL; $family = NULL; $date = NULL; - $nameParts = $node->getElementsByTagName('namePart'); - foreach ($nameParts as $part) { + $name_parts = $node->getElementsByTagName('namePart'); + foreach ($name_parts as $part) { switch ($part->getAttribute('type')) { case 'given': $given = $part->nodeValue; break; @@ -78,9 +81,9 @@ function ife_autocomplete_person($string) { } $role = NULL; - $roleTerm = $node->getElementsByTagName('roleTerm'); - if ($roleTerm->length > 0) { - $role = $roleTerm->item(0)->nodeValue; + $role_term = $node->getElementsByTagName('roleTerm'); + if ($role_term->length > 0) { + $role = $role_term->item(0)->nodeValue; } if (strpos(strtolower($name), $string) !== FALSE) { @@ -95,7 +98,7 @@ function ife_autocomplete_person($string) { } function ife_autocomplete_marcrelator($collection, $string='') { - $moduleRoot = drupal_get_path('module', 'islandora_form_elements'); + $module_root = drupal_get_path('module', 'islandora_form_elements'); if ($string == '') { $string = $collection; @@ -104,30 +107,30 @@ function ife_autocomplete_marcrelator($collection, $string='') { $string = ucfirst(trim($string)); - $dom = DOMDocument::load($moduleRoot . '/xml/relators.rdf'); - $rootEl = $dom->getElementsByTagName('RDF'); - if ($rootEl->length > 0) { - $rootEl = $rootEl->item(0); + $dom = DOMDocument::load($module_root . '/xml/relators.rdf'); + $root_el = $dom->getElementsByTagName('RDF'); + if ($root_el->length > 0) { + $root_el = $root_el->item(0); $xpath = new DOMXPath($dom); - $xpath->registerNamespace('skos', $rootEl->getAttribute('xmlns:skos')); - $xpath->registerNamespace('rdf', $rootEl->getAttribute('xmlns:rdf')); + $xpath->registerNamespace('skos', $root_el->getAttribute('xmlns:skos')); + $xpath->registerNamespace('rdf', $root_el->getAttribute('xmlns:rdf')); $result = $xpath->query('/rdf:RDF/rdf:Description[starts-with(skos:prefLabel, "' . $string . '")]'); $terms = array(); foreach ($result as $term) { - $termVal = $term->getElementsByTagName('prefLabel')->item(0)->nodeValue; - $termVal = preg_replace('/\s+/', ' ', $termVal); - $terms[$term->getElementsByTagName('notation')->item(0)->nodeValue] = $termVal; + $term_val = $term->getElementsByTagName('prefLabel')->item(0)->nodeValue; + $term_val = preg_replace('/\s+/', ' ', $term_val); + $terms[$term->getElementsByTagName('notation')->item(0)->nodeValue] = $term_val; } echo drupal_json($terms); } } function ife_autocomplete_gacs($collection, $string='') { - $moduleRoot = drupal_get_path('module', 'islandora_form_elements'); + $module_root = drupal_get_path('module', 'islandora_form_elements'); if ($string == '') { $string = $collection; @@ -136,13 +139,13 @@ function ife_autocomplete_gacs($collection, $string='') { $string = ucwords(trim($string)); - $dom = DOMDocument::load($moduleRoot . '/xml/gacs.xml'); - $rootEl = $dom->getElementsByTagName('codelist'); - if ($rootEl->length > 0) { - $rootEl = $rootEl->item(0); + $dom = DOMDocument::load($module_root . '/xml/gacs.xml'); + $root_el = $dom->getElementsByTagName('codelist'); + if ($root_el->length > 0) { + $root_el = $root_el->item(0); $xpath = new DOMXPath($dom); - $xpath->registerNamespace('a', $rootEl->getAttribute('xmlns')); + $xpath->registerNamespace('a', $root_el->getAttribute('xmlns')); $result = $xpath->query('/a:codelist/a:gacs/a:gac[starts-with(a:name, "' . $string . '")]'); @@ -155,7 +158,7 @@ function ife_autocomplete_gacs($collection, $string='') { } function ife_autocomplete_language($collection, $string='') { - $moduleRoot = drupal_get_path('module', 'islandora_form_elements'); + $module_root = drupal_get_path('module', 'islandora_form_elements'); if ($string == '') { $string = $collection; @@ -164,13 +167,13 @@ function ife_autocomplete_language($collection, $string='') { $string = ucwords(trim($string)); - $dom = DOMDocument::load($moduleRoot . '/xml/languages.xml'); - $rootEl = $dom->getElementsByTagName('codelist'); - if ($rootEl->length > 0) { - $rootEl = $rootEl->item(0); + $dom = DOMDocument::load($module_root . '/xml/languages.xml'); + $root_el = $dom->getElementsByTagName('codelist'); + if ($root_el->length > 0) { + $root_el = $root_el->item(0); $xpath = new DOMXPath($dom); - $xpath->registerNamespace('a', $rootEl->getAttribute('xmlns')); + $xpath->registerNamespace('a', $root_el->getAttribute('xmlns')); $result = $xpath->query('/a:codelist/a:languages/a:language[starts-with(a:name, "' . $string . '")]'); @@ -192,10 +195,10 @@ function ife_autocomplete($field, $collection, $string='') { module_load_include('php', 'islandora_solr_search', 'Solr/Service'); $host = variable_get('islandora_solr_search_block_host', 'localhost'); $port = variable_get('islandora_solr_search_block_port', '8080'); - $appName = variable_get('islandora_solr_search_block_app_name', 'solr'); - $solr = new Apache_Solr_Service($host, $port, '/' . $appName . '/'); + $app_name = variable_get('islandora_solr_search_block_app_name', 'solr'); + $solr = new Apache_Solr_Service($host, $port, '/' . $app_name . '/'); - $additionalParams = array( + $additional_params = array( 'fl' => $field ); @@ -206,9 +209,9 @@ function ife_autocomplete($field, $collection, $string='') { } try { - $results = $solr->search($query, 0, 10, $additionalParams); + $results = $solr->search($query, 0, 10, $additional_params); } catch (Exception $e) { - drupal_set_message(t('error searching ') . $e->getMessage()); + drupal_set_message(t('error searching') . " " . $e->getMessage()); } $docs = $results->response->docs; diff --git a/form_elements/includes/creative_commons.inc b/form_elements/includes/creative_commons.inc index 38760c2d..041e9cdc 100644 --- a/form_elements/includes/creative_commons.inc +++ b/form_elements/includes/creative_commons.inc @@ -1,6 +1,11 @@ 'International', diff --git a/form_elements/includes/filechooser.inc b/form_elements/includes/filechooser.inc index c4b43717..a53cd836 100644 --- a/form_elements/includes/filechooser.inc +++ b/form_elements/includes/filechooser.inc @@ -1,5 +1,9 @@ @@ -26,7 +30,7 @@ function theme_filechooser($element) {
- + '; return theme('form_element', $element, $output); } @@ -36,7 +40,7 @@ function ife_filechooser_get_thumbnail($cp_pid, $cm_pid, $file) { module_load_include('inc', 'fedora_repository', 'ContentModel'); module_load_include('inc', 'fedora_repository', 'MimeClass'); - $mimeClass = new MimeClass(); + $mime_class = new MimeClass(); $cm = ContentModel::loadFromModel($cm_pid); $cp = CollectionPolicy::loadFromCollection($cp_pid); @@ -45,7 +49,7 @@ function ife_filechooser_get_thumbnail($cp_pid, $cm_pid, $file) { if ($cm !== FALSE && $cp !== FALSE) { if (is_file($path . $file)) { - $mime = $mimeClass->getType($path . $file); + $mime = $mime_class->getType($path . $file); $allowed_types = $cm->getMimetypes(); @@ -57,7 +61,7 @@ function ife_filechooser_get_thumbnail($cp_pid, $cm_pid, $file) { $thumbnail = $_SESSION['fedora_ingest_files']['TN']; } - $thumbmime = $mimeClass->getType($thumbnail); + $thumbmime = $mime_class->getType($thumbnail); header('Pragma: no-cache'); header('Content-Type: ' . $thumbmime); @@ -85,7 +89,7 @@ function ife_filechooser_generate_thumbnails($cp_pid, $cm_pid) { exit(); } - $mimeClass = new MimeClass(); + $mime_class = new MimeClass(); $path = $cp->getStagingArea() . '/'; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $end = isset($_GET['end']) ? intval($_GET['end']) : 50; @@ -97,7 +101,7 @@ function ife_filechooser_generate_thumbnails($cp_pid, $cm_pid) { $dir = opendir($path); for ($i = $start; $i < $end && ($file = readdir($dir)) !== FALSE;) { if (is_file($path . $file)) { - $mime = $mimeClass->getType($path . $file); + $mime = $mime_class->getType($path . $file); if (in_array($mime, $allowed_types)) { $thumbnail = FALSE; diff --git a/form_elements/includes/people.inc b/form_elements/includes/people.inc index 421e0a3b..6ffbbc4f 100644 --- a/form_elements/includes/people.inc +++ b/form_elements/includes/people.inc @@ -1,11 +1,15 @@ 0) { @@ -82,17 +86,17 @@ function ife_remove_person_submit($form, &$form_state) { $keys = array(); $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; + $people_vals = &$form_state['values']; while (count($keys) > 0) { $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; + if (isset($people_vals[$key])) { + $people_vals = &$people_vals[$key]; } } $people = array(); $i = 0; - foreach ($peopleVals['people'] as $key => $val) { + foreach ($people_vals['people'] as $key => $val) { if ($key != $delta) { $people[] = $val; } @@ -115,24 +119,24 @@ function ife_add_person_submit($form, &$form_state) { $people = array(); $keys = array(); $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; + $people_vals = &$form_state['values']; while (count($keys) > 0) { $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; + if (isset($people_vals[$key])) { + $people_vals = &$people_vals[$key]; } } - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); + if (!is_array($people_vals['people'])) + $people_vals['people'] = array(); - foreach ($peopleVals['people'] as $val) { + foreach ($people_vals['people'] as $val) { $people[] = $val; } //only add new person if we are not adding from repository. - $elName = isset($qt_form['entity0']['#parents'][0]) ? $qt_form['entity0']['#parents'][0] : NULL; - if ($elName == NULL || !isset($form_state['clicked_button']['#post'][$elName]['add_from_repository']) || trim($form_state['clicked_button']['#post'][$elName]['add_from_repository']) == '') { + $el_name = isset($qt_form['entity0']['#parents'][0]) ? $qt_form['entity0']['#parents'][0] : NULL; + if ($el_name == NULL || !isset($form_state['clicked_button']['#post'][$el_name]['add_from_repository']) || trim($form_state['clicked_button']['#post'][$el_name]['add_from_repository']) == '') { $people[] = array('name' => '', 'date' => '', 'role' => '', 'subject' => ''); } unset($form_state['submit_handlers']); @@ -148,19 +152,19 @@ function ife_add_org_submit($form, &$form_state) { $people = array(); $keys = array(); $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; + $people_vals = &$form_state['values']; while (count($keys) > 0) { $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; + if (isset($people_vals[$key])) { + $people_vals = &$people_vals[$key]; } } - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); + if (!is_array($people_vals['people'])) + $people_vals['people'] = array(); - foreach ($peopleVals['people'] as $val) { + foreach ($people_vals['people'] as $val) { $people[] = $val; } $people[] = array('role' => '', 'organization' => ''); @@ -178,17 +182,17 @@ function ife_add_conf_submit($form, &$form_state) { $people = array(); $keys = array(); $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; + $people_vals = &$form_state['values']; while (count($keys) > 0) { $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; + if (isset($people_vals[$key])) { + $people_vals = &$people_vals[$key]; } } - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); + if (!is_array($people_vals['people'])) + $people_vals['people'] = array(); - foreach ($peopleVals['people'] as $val) { + foreach ($people_vals['people'] as $val) { $people[] = $val; } diff --git a/ilives/image_rotator_tagger_block.inc b/ilives/image_rotator_tagger_block.inc index a86c4291..d5177101 100755 --- a/ilives/image_rotator_tagger_block.inc +++ b/ilives/image_rotator_tagger_block.inc @@ -2,7 +2,7 @@ -/* +/** * @file image_rotator_tagger_block.inc */ @@ -67,8 +67,12 @@ function _fedora_image_rotator_tagger_block_content() { $image_item = new Fedora_Item($result['pid']); } if (!empty($result)) { + + $image = theme_image( . $base_url . '/fedora/imageapi/' . $result['pid'] . '/JPG?op=scale&height=500&width=300'); + return '

' . l('', 'fedora/repository/' . $result['pid'], array('html' => TRUE, 'alias' => TRUE)) + //. l(t("!image", array(image => $image)) . '

This image is from ' . l($result['title'], 'fedora/ilives_book_viewer/' . substr($image_item->pid, 0, strrpos($image_item->pid, '-')), array('html' => TRUE, 'alias' => TRUE)) . '.' . drupal_get_form('fedora_repository_image_tagging_form', $result['pid']) . '

'; } diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index 87de1b83..a097de73 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -72,7 +72,7 @@ class Refworks { //$dom = dom_import_simplexml($xml);//test to see if it behaves better //$xml = new SimpleXMLElement(trim(file_get_contents($file))); } catch (Exception $e) { - drupal_set_message(t('Error processing Refworks file:') . $e->getMessage()); + drupal_set_message(t('Error processing Refworks file:') . " " . $e->getMessage()); return FALSE; } $this->referenceList = array(); diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index 7292a926..be9c80b0 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -84,7 +84,7 @@ class ShowStreamsInFieldSets { } $dc_html = $objectHelper->getFormattedDC($item); - $dl_link = l(t('

View Document
'), 'fedora/repository/' . $this->pid . '/OBJ', array('html' => TRUE)); + $dl_link = l('

View Document
', 'fedora/repository/' . $this->pid . '/OBJ', array('html' => TRUE)); $tabset['first_tab']['tabs']['view'] = array( '#type' => 'tabpage',