Permalink
Browse files

Remove more deprecated methods and classes.

  • Loading branch information...
1 parent 9b2cf35 commit 25c3c6c935d871c3b1ae1add64a1f789d70b174c @zerocrates zerocrates committed Mar 9, 2012
@@ -33,56 +33,6 @@ public function filter($value)
}
/**
- * 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.
*
* @param string $name
@@ -1,19 +0,0 @@
-<?php
-/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
- */
-
-/**
- * Should not exist. Do NOT instantiate or reference this class in any way.
- *
- * @deprecated
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- */
-class Omeka_Output_Xml
-{}
@@ -306,20 +306,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.
*
* @param mixed $value
@@ -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;
- }
}
@@ -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);
- }
}
Submodule seasons updated 1 files
+1 −1 common/header.php

0 comments on commit 25c3c6c

Please sign in to comment.