Exemple #1
0
 /**
  * @return Media_Model_Adapter_Abstract
  */
 public static function getMediaAdapter()
 {
     if (null === self::$_adapter) {
         self::$_adapter = Media_Model_Adapter::factory(self::$_mediaOptions['adapter'], self::$_mediaOptions['params']);
     }
     return self::$_adapter;
 }
Exemple #2
0
 /**
  * Test unit of test unit
  */
 public function testGetRelativePathFromTo()
 {
     $fileTable = new Media_Model_DbTable_File();
     $row = $fileTable->createRow();
     $os = 'linux';
     if (isset($_SERVER['OS']) && preg_match('`Window`i', $_SERVER['OS'])) {
         $os = 'windows';
     }
     if ('linux' == $os) {
         $this->assertEquals('../user', $row->getRelativePathFromTo('/home', '/user', false));
         $this->assertEquals('../../user', $row->getRelativePathFromTo('/home/lchenay', '/user', false));
         $this->assertEquals('../oo/test', $row->getRelativePathFromTo('/home/lchenay', '/home/oo/test', false));
     } else {
         $this->assertEquals('..\\user', $row->getRelativePathFromTo('c:\\home', 'c:\\user', false));
         $this->assertEquals('..\\..\\user', $row->getRelativePathFromTo('c:\\home\\lchenay', 'c:\\user', false));
         $this->assertEquals('..\\oo\\test', $row->getRelativePathFromTo('c:\\home\\lchenay', 'c:\\home\\oo\\test', false));
         $this->assertEquals('..\\library\\Centurion\\Contrib\\media\\tests\\Support\\images\\centurion.png', $row->getRelativePathFromTo('C:\\UwAmp\\www\\Centurion\\tests', 'C:\\UwAmp\\www\\Centurion/library/Centurion/Contrib/media/tests/Support/images/centurion.png', false));
     }
 }
Exemple #3
0
 /**
  * Get Media options and set it in Media_Model_DbTable_File.
  */
 public function _initOptions()
 {
     $this->bootstrap('FrontController');
     Media_Model_DbTable_File::setMediaOptions($this->getOptions());
 }
Exemple #4
0
 public function getTemporaryKey($effect, $mktime = null)
 {
     return Media_Model_DbTable_File::getMediaAdapter()->getTemporaryKey($this->pk, $effect, $mktime);
 }