Example #1
0
 /**
  * Implements Phata\Widgetfy\MediaFile\Common::translate
  *
  * preprocess the URL
  * by this site adapter
  * @param string[] $url_parsed result of parse_url($url)
  * @return mixed array of preprocess result; boolean FALSE if not translatable
  */
 public static function preprocess($url_parsed)
 {
     if (preg_match('/\\/([^\\/]+)\\.(rm|rmvb)$/i', $url_parsed['path'], $matches) == 1) {
         $filename = htmlspecialchars($matches[1] . '.' . $matches[2]);
         $extension = strtolower($matches[2]);
         return array('filetype' => $extension, 'url' => URL::build($url_parsed));
     }
     return FALSE;
 }
Example #2
0
 /**
  * Implements Phata\Widgetfy\MediaFile\Common::translate
  *
  * preprocess the URL
  * by this site adapter
  * @param string[] $url_parsed result of parse_url($url)
  * @return mixed array of preprocess result; boolean FALSE if not translatable
  */
 public static function preprocess($url_parsed)
 {
     if (preg_match('/\\.(\\w+)$/i', $url_parsed['path'], $matches) == 1) {
         $extension = strtolower($matches[1]);
         if ($extension == 'ogv') {
             $extension = 'ogg';
         }
         return array('filetype' => $extension, 'url' => URL::build($url_parsed));
     }
     return FALSE;
 }
Example #3
0
 /**
  * Implements Phata\Widgetfy\Site\Common::translate
  *
  * preprocess the URL
  * by this site adapter
  * @param string[] $url_parsed result of parse_url($url)
  * @return mixed array of preprocess result; boolean FALSE if not translatable
  */
 public static function preprocess($url_parsed)
 {
     $url = URL::build($url_parsed);
     if (preg_match('/^[\\w\\/]*\\/index.html$/', $url_parsed['path']) == 1) {
         parse_str($url_parsed['query'], $args);
         if (isset($args['s']) && isset($args['i'])) {
             return array('url' => $url);
         }
     }
     return FALSE;
 }
Example #4
0
 public function testURL8()
 {
     $url = '#somehash';
     $parsed = parse_url($url);
     $result = URL::build($parsed);
     $this->assertEquals($url, $result);
 }