Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* URL shortener
|
||||
* Owner: Matt Mecham
|
||||
* Last Updated: $Date: 2010-01-22 10:10:04 -0500 (Fri, 22 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24th November 2009
|
||||
* @version $Revision: 5742 $
|
||||
*/
|
||||
|
||||
|
||||
/* Class name must match shortener directory name */
|
||||
class bitly extends urlShorten
|
||||
{
|
||||
private $_config = array();
|
||||
|
||||
private $_cfm;
|
||||
|
||||
/**
|
||||
* Method constructor
|
||||
*
|
||||
* If you pass false as the key, it will not save out the imported GUIDs
|
||||
* @access public
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function __construct( $config=array() )
|
||||
{
|
||||
$this->_config = $config;
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );
|
||||
$this->_cfm = new classFileManagement();
|
||||
$this->_cfm->use_sockets = 1;
|
||||
$this->_cfm->timeout = 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorten URL
|
||||
*
|
||||
* @access public
|
||||
* @param string URL to shorten
|
||||
* @return array ( 'status' => [ok/failed], 'url' => [shortened url], 'method' => [api used], 'raw' => [any raw data] )
|
||||
* Exception codes:
|
||||
*/
|
||||
public function apiShorten( $url )
|
||||
{
|
||||
/* Query the service */
|
||||
$response = $this->_cfm->getFileContents( "http://api.bit.ly/shorten?version=2.0.1&longUrl=" . urlencode( $url ) . "&login={$this->_config['login']}&apiKey={$this->_config['apiKey']}" );
|
||||
|
||||
if ( ! $response )
|
||||
{
|
||||
return array( 'status' => 'failed' );
|
||||
}
|
||||
|
||||
$obj = json_decode( $response, TRUE );
|
||||
|
||||
return array( 'status' => 'ok',
|
||||
'url' => $obj['results'][$url]['shortUrl'],
|
||||
'method' => 'bitly',
|
||||
'raw' => $obj['results'] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* URL shortener
|
||||
* Owner: Matt Mecham
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 24th November 2009
|
||||
* @version $Revision: 5713 $
|
||||
*/
|
||||
|
||||
$config = array();
|
||||
|
||||
/* Login... */
|
||||
$config['login'] = 'invisionps';
|
||||
|
||||
/* API KEY - You can find your apiKey at http://bit.ly/account/your_api_key : */
|
||||
$config['apiKey'] = 'R_eee8c282b147b0aed1bce4370ac81744';
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> Forbidden</h1>
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user