X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=library%2Fslinky.php;h=fc3714c2019598395844317a8ed7ff8324ab6e0c;hb=db04a78d844f5fc528bf7ffb2c2c04767ab64b5f;hp=56734c9fb056678a94e1c3af76ed4f7b871e0eaa;hpb=955022e7dc6bb8f581177ddbad84b4f59c349763;p=friendica.git diff --git a/library/slinky.php b/library/slinky.php old mode 100755 new mode 100644 index 56734c9fb0..fc3714c201 --- a/library/slinky.php +++ b/library/slinky.php @@ -181,11 +181,11 @@ class Slinky { $this->service = new Slinky_Fongs(); break; } - case $this->get( 'yourls-url' ): - if ( class_exists( 'Slinky_YourLS' ) ) { - $this->service = new Slinky_YourLS(); - break; - } + case $this->get( 'yourls-url' ): + if ( class_exists( 'Slinky_YourLS' ) ) { + $this->service = new Slinky_YourLS(); + break; + } case 'micurl.com': if ( class_exists( 'Slinky_Micurl' ) ) { $this->service = new Slinky_Micurl(); @@ -341,7 +341,7 @@ abstract class Slinky_Service { curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections + //curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections $r = curl_exec( $ch ); if ( curl_errno( $ch ) ) { return false; @@ -372,7 +372,7 @@ abstract class Slinky_Service { curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections + //curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections $r = curl_exec( $ch ); if ( curl_errno( $ch ) ) { return false; @@ -581,27 +581,27 @@ class Slinky_Fongs extends Slinky_Service { // yourls class Slinky_YourLS extends Slinky_Service { - function url_is_short( $url ) { - return stristr( $url, 'shit.li/' ); + function url_is_short( $url ) { + return stristr( $url, 'shit.li/' ); } - function url_is_long( $url ) { - return !stristr( $url, 'shit.li/' ); + function url_is_long( $url ) { + return !stristr( $url, 'shit.li/' ); } - function make_short( $url ) { + function make_short( $url ) { echo $this->get( 'username' ); $use_ssl = $this->get( 'ssl' ); if ( $use_ssl ) $use_ssl = 's'; else $use_ssl = ''; - $result = $this->url_get( 'http'. $use_ssl . '://' . $this->get( 'yourls-url' ) . '/yourls-api.php?username=' . $this->get( 'username' ) . '&password=' . $this->get( 'password' ) . '&action=shorturl&format=simple&url=' . urlencode( $url ) ); - if ( 1 != $result && 2 != $result ) - return $result; - else - return $url; - } + $result = $this->url_get( 'http'. $use_ssl . '://' . $this->get( 'yourls-url' ) . '/yourls-api.php?username=' . $this->get( 'username' ) . '&password=' . $this->get( 'password' ) . '&action=shorturl&format=simple&url=' . urlencode( $url ) ); + if ( 1 != $result && 2 != $result ) + return $result; + else + return $url; + } } // Micu.rl