UrlMatchs.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. namespace Muzich\CoreBundle\Factory;
  3. use Muzich\CoreBundle\Entity\Element;
  4. class UrlMatchs
  5. {
  6. /*
  7. * Si il y a un Element::TYPE_NOTMATCH le placer en début de tableau !
  8. */
  9. public static $jamendo = array(
  10. Element::TYPE_TRACK => array(
  11. // http://www.jamendo.com/fr/track/894974
  12. "#^\/[a-zA-Z0-9_-]+\/track\/([0-9]+)#" => 1,
  13. // http://www.jamendo.com/fr/track/347602/come-come
  14. "#^\/[a-zA-Z0-9_-]+\/track\/([0-9]+)\/.#" => 1
  15. ),
  16. Element::TYPE_ALBUM => array(
  17. // http://www.jamendo.com/fr/album/3409
  18. "#^\/[a-zA-Z0-9_-]+\/album\/([0-9]+)#" => 1,
  19. // http://www.jamendo.com/fr/list/a45666/proceed-positron...
  20. "#^\/[a-zA-Z0-9_-]+\/list\/a([0-9]+)\/.#" => 1
  21. )
  22. );
  23. public static $soundcloud = array(
  24. Element::TYPE_NOTMATCH => array(
  25. "#\/search\?q#" => null
  26. ),
  27. Element::TYPE_OTHER => array(
  28. // http://soundcloud.com/matas/sets/library-project
  29. "#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#" => null,
  30. // http://soundcloud.com/noisia/black-sun-empire-noisia-feed
  31. // http://soundcloud.com/user4818423/mechanika-crew-andrew-dj-set
  32. "#^\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+#" => null,
  33. // http://snd.sc/11CyOpN
  34. "#\/[a-zA-Z0-9_-]#" => null
  35. )
  36. );
  37. public static $dailymotion = array(
  38. Element::TYPE_OTHER => array(
  39. // http://dailymotion.com/video/xnqcwx_le-nazisme-dans-le-couple_fun#hp-v-v2
  40. "#\/(video\/)([a-zA-Z0-9]+)([a-zA-Z0-9_-]*)#" => 2
  41. )
  42. );
  43. public static $deezer = array(
  44. Element::TYPE_ALBUM => array(
  45. // http://www.deezer.com/fr/music/pantera/far-beyond-driven-80398
  46. "#^\/[a-zA-Z_-]+\/music\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+-([0-9]+)#" => 1,
  47. // http://www.deezer.com/fr/album/379324
  48. "#^\/[a-zA-Z_-]+\/album\/([0-9]+)#" => 1
  49. ),
  50. Element::TYPE_PLAYLIST => array(
  51. // http://www.deezer.com/fr/music/playlist/18701350
  52. "#^\/[a-zA-Z_-]+\/music\/playlist\/([0-9]+)#" => 1
  53. ),
  54. Element::TYPE_TRACK => array(
  55. // http://www.deezer.com/track/4067216
  56. "#^\/track\/([0-9]+)#" => 1,
  57. // http://www.deezer.com/fr/track/67238730
  58. "#^\/[a-zA-Z_-]+\/track/([0-9]+)#" => 1
  59. )
  60. );
  61. public static $spotify = array(
  62. Element::TYPE_TRACK => array(
  63. // http://open.spotify.com/track/7ylMdCOkqumPAwIMb6j2D5
  64. "#^\/track\/([a-zA-Z0-9]+)#" => 1
  65. ),
  66. Element::TYPE_ALBUM => array(
  67. // http://open.spotify.com/album/1VAB3Xn92dPKPWzocgQqkh
  68. "#^\/album\/([a-zA-Z0-9]+)#" => 1
  69. ),
  70. Element::TYPE_PLAYLIST => array(
  71. // http://open.spotify.com/user/bux/playlist/2kNeCiQaATbUi3lixhNwco
  72. "#^\/user\/([a-zA-Z0-9_-]+)\/playlist\/([a-zA-Z0-9]+)#" => 2
  73. )
  74. );
  75. public static $vimeo = array(
  76. Element::TYPE_OTHER => array(
  77. // http://vimeo.com/43258820
  78. "#\/([0-9]+)#" => 1
  79. )
  80. );
  81. public static $youtu = array(
  82. Element::TYPE_OTHER => array(
  83. // http://youtu.be/2-5xt9MrI9w
  84. "#\/([a-zA-Z0-9_-]+)#" => 1
  85. )
  86. );
  87. public static $youtube = array(
  88. Element::TYPE_OTHER => array(
  89. // https://www.youtube.com/watch?feature=player_detailpage&v=M9PkADawUKU#t=73s
  90. "#\/(watch|)(\?|)feature\=player_detailpage\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3,
  91. // https://www.youtube.com/watch?v=2-5xt9MrI9w
  92. "#\/(watch|)(\?|)v=([a-zA-Z0-9_-]+)#" => 3,
  93. // http://m.youtube.com/watch?feature=youtu.be&v=QQ3L3mqP5JY&desktop_uri=%2Fwatch%3Fv%3DQQ3L3mqP5JY%26feature%3Dyoutu.be
  94. "#\/(watch|)(\?|)feature\=youtu.be\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3,
  95. // https://www.youtube.com/watch?feature=player_embedded&v=PBoc0kuiEn0
  96. "#\/(watch|)(\?|)feature\=player_embedded\&v=([a-zA-Z0-9_-]+)([.\w\W\d]*)#" => 3,
  97. )
  98. );
  99. }