File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ public function __wakeup () {
4848 * Resolve the possible redirects for this url (for example bit.ly or any other url shortcutter)
4949 */
5050 private function resolve () {
51+ UrlJsRedirect::resolve ($ this );
52+
5153 $ connection = curl_init ();
5254
5355 curl_setopt_array ($ connection , array (
@@ -532,8 +534,10 @@ private function buildUrl ($maintainCache = false) {
532534 if (isset ($ this ->info ['host ' ])) {
533535 $ url .= $ this ->info ['host ' ];
534536 }
535-
536- $ url .= '/ ' .$ this ->getPath ();
537+
538+ if (($ path = $ this ->getPath ())) {
539+ $ url .= '/ ' .$ path ;
540+ }
537541
538542 if (isset ($ this ->info ['file ' ])) {
539543 $ url .= '/ ' .$ this ->info ['file ' ];
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Class to manipulate urls
4+ */
5+ namespace Embed ;
6+
7+ class UrlJsRedirect {
8+ protected static $ urls = array (
9+ 'google ' => 'https?://www.google.com/url* '
10+ );
11+
12+ public static function resolve (Url $ Url ) {
13+ foreach (static ::$ urls as $ method => $ matches ) {
14+ if ($ Url ->match ($ matches )) {
15+ static ::$ method ($ Url );
16+
17+ return true ;
18+ }
19+ }
20+
21+ return false ;
22+ }
23+
24+ protected static function google (Url $ Url ) {
25+ if (($ url = $ Url ->getParameter ('url ' ))) {
26+ $ Url ->setUrl ($ url );
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments