Skip to content

Commit

Permalink
Remove more deprecated methods and classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Mar 9, 2012
1 parent 9b2cf35 commit 25c3c6c
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 125 deletions.
50 changes: 0 additions & 50 deletions application/libraries/Omeka/Filter/Filename.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,56 +32,6 @@ public function filter($value)
return $targetPath;
}

/**
* Strip out whitespace, non-printable characters, extra . characters, and
* convert all spaces to dashes. This is applied to every file that is uploaded
* to Omeka so that there will be no problems with funky characters in filenames.
*
* @deprecated Filenames are now MD5 hashes, this method should not be used.
* @param string $name
* @return string
*/
public function sanitizeFilename($name)
{
//Strip whitespace
$name = trim($name);

/* Remove all but last .
I wish there was an easier way of doing this */
if(substr_count($name,'.') > 1) {
$array = explode('.',$name);
if(count($array) > 2) {
$last = array_pop($array);
$first = join('', $array);
$name = array();
if(!empty($first)) {
$name = $first;
}
if(!empty($last)) {
$name .= '.'.$last;
}
}
}

//Strip out invalid characters
$invalid = array('"','*','/',':','<','>','?','|',"'",'&',';','#','\\');
$name = str_replace($invalid, '', $name);

//Strip out non-printable characters
for ($i = 0; $i < 32; $i++) {
$nonPrintable[$i] = chr($i);
}
$name = str_replace($nonPrintable, '', $name);

//Convert to lowercase (avoid corrupting UTF-8)
$name = strtolower($name);

//Convert remaining spaces to hyphens
$name = str_replace(' ', '-', $name);

return $name;
}

/**
* Creates a new, random filename for storage in the archive.
*
Expand Down
19 changes: 0 additions & 19 deletions application/libraries/Omeka/Output/Xml.php

This file was deleted.

14 changes: 0 additions & 14 deletions application/libraries/Omeka/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,6 @@ protected function runCallbacks($event)
}
}

/**
* Fire a plugin hook associated with the given event.
*
* @deprecated
* @see Omeka_Record::runCallbacks()
* @param string $event Underscore-separated event name.
* @return void
*/
protected function firePlugin($event)
{
$hook = $event . '_' . strtolower(get_class($this));
fire_plugin_hook($hook, $this);
}

/**
* Add a value to the record-specific cache.
*
Expand Down
24 changes: 0 additions & 24 deletions application/models/ItemTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,28 +428,4 @@ protected function findNearby($item, $position = 'next')

return $this->fetchObject($select);
}

/**
* Finds a random featured item.
*
* @deprecated Since 1.4.
* @see findBy There are parameters for returning items randomly and with
* derivative images as of version 1.4.
*
* @param bool $withImage Whether to find an item with a derivative image.
* @return Item
*/
public function findRandomFeatured($withImage=true)
{
$params = array('featured' => 1, 'sort_field' => 'random');
if ($withImage) {
$params['hasImage'] = 1;
}
$select = $this->getSelectForFindBy($params);
$select->limit(1);

$item = $this->fetchObject($select);

return $item;
}
}
17 changes: 0 additions & 17 deletions application/tests/integration/Models/ItemTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,4 @@ public function testSearchFilters()
$randomSelect = $this->table->getSelectForFindBy(array('sort_field' => 'random'));
$this->assertContains("RAND()", (string)$randomSelect);
}

public function testFindRandomFeaturedDefault()
{
$featuredItem = $this->table->findRandomFeatured();
$query = $this->dbAdapter->getProfiler()->getLastQueryProfile()->getQuery();
$this->assertContains("LEFT JOIN omeka_files AS f ON f.item_id = i.id", $query);
$this->assertContains("(i.featured = 1)", $query);
$this->assertContains("(f.has_derivative_image = '1')", $query);

}

public function testFindRandomFeaturedWithoutImage()
{
$featuredItem = $this->table->findRandomFeatured(false);
$query = $this->dbAdapter->getProfiler()->getLastQueryProfile()->getQuery();
$this->assertContains("(i.featured = 1)", $query);
}
}
2 changes: 1 addition & 1 deletion themes/seasons
Submodule seasons updated 1 files
+1 −1 common/header.php

0 comments on commit 25c3c6c

Please sign in to comment.