Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Delicious share link
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Sept 2013
|
||||
* @see <a href='https://delicious.com/tools'>Delicious button documentation</a>
|
||||
*/
|
||||
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delicious share link
|
||||
* @note Delicious does not provide any method to control the locale/language
|
||||
*/
|
||||
class _Delicious
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$url = \IPS\Http\Url::external( "https://del.icio.us/save?jump=close&noui=1&v=5" )->setQueryString( 'provider', urlencode( \IPS\Settings::i()->board_name ) );
|
||||
|
||||
if( $this->url !== NULL )
|
||||
{
|
||||
$url = $url->setQueryString( 'url', (string) $this->url );
|
||||
}
|
||||
|
||||
if( $this->title !== NULL )
|
||||
{
|
||||
$url = $url->setQueryString( 'title', $this->title );
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->delicious( $url );
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Digg share link
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Sept 2013
|
||||
* @see <a href='http://ftllc.com/articles/social-media-buttons.php'>Digg button</a> (This was the best I could find...Digg has removed most of their button documentation it seems)
|
||||
*/
|
||||
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Digg share link
|
||||
* @note Digg does not provide any method to control the locale/language
|
||||
* @note Digg does not provide any method to control the URL or specify any title
|
||||
*/
|
||||
class _Digg
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->digg( \IPS\Http\Url::external( 'http://digg.com/submit' )->setQueryString( 'url', (string) $this->url ) );
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -20,58 +20,15 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Email share link
|
||||
*/
|
||||
class _Email
|
||||
class _Email extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->email( (string) $this->url->setQueryString( array( 'do' => 'email' ) ) );
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->email( urlencode( $this->url ), $this->title );
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -21,48 +21,15 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Facebook share link
|
||||
*/
|
||||
class _Facebook
|
||||
class _Facebook extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish text or a URL to this service
|
||||
* @deprecated 4.3.3: Facebook have removed access to permission this method needs. Retaining method for 3rd party compatibility
|
||||
*
|
||||
* @param string $content Text to publish
|
||||
* @param string $url [URL to publish]
|
||||
* @return @void
|
||||
* @return void
|
||||
*/
|
||||
public static function publish( $content, $url=null )
|
||||
{
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Google +1 share link
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Sept 2013
|
||||
* @see <a href='https://developers.google.com/+/web/+1button/'>Google +1 button documentation</a>
|
||||
*/
|
||||
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Google +1 share link
|
||||
*/
|
||||
class _Googleplusone
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
* @note Google +1 automatically determines title/description based on page microdata
|
||||
* @see <a href='https://developers.google.com/+/web/snippet/'>Snippet documentation</a>
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->google( urlencode( $this->url ) );
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -21,51 +21,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Linked In share link
|
||||
*/
|
||||
class _Linkedin
|
||||
class _Linkedin extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -20,18 +20,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Pinterest share link
|
||||
*/
|
||||
class _Pinterest
|
||||
class _Pinterest extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* @brief Ccontent item
|
||||
*/
|
||||
@@ -42,36 +32,16 @@ class _Pinterest
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @param \IPS\Content|NULL $item Content item (or comment) to share
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL, $item=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
$this->item = $item;
|
||||
$this->item = $item;
|
||||
|
||||
parent::__construct( $url, $title );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @param \IPS\core\ShareLinks\Service $service The service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form, $service )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -22,51 +22,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
* Reddit share link
|
||||
* @note Reddit does not provide any method to control the locale/language
|
||||
*/
|
||||
class _Reddit
|
||||
class _Reddit extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Share Services Abstract Class
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 21 Aug 2018
|
||||
*/
|
||||
|
||||
namespace IPS\Content;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Share Services Abstract Class
|
||||
*/
|
||||
abstract class _ShareServices
|
||||
{
|
||||
/**
|
||||
* Get services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function services()
|
||||
{
|
||||
return array(
|
||||
'Facebook' => 'IPS\Content\ShareServices\Facebook',
|
||||
'Twitter' => 'IPS\Content\ShareServices\Twitter',
|
||||
'Linkedin' => 'IPS\Content\ShareServices\Linkedin',
|
||||
'Pinterest' => 'IPS\Content\ShareServices\Pinterest',
|
||||
'Reddit' => 'IPS\Content\ShareServices\Reddit',
|
||||
'Email' => 'IPS\Content\ShareServices\Email',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cached services
|
||||
*/
|
||||
static $services = NULL;
|
||||
|
||||
/**
|
||||
* Helper method to get the class based on the key
|
||||
*
|
||||
* @param string $key Service to load
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function getClassByKey( $key )
|
||||
{
|
||||
if ( static::$services == NULL )
|
||||
{
|
||||
static::$services = static::services();
|
||||
}
|
||||
|
||||
if ( !isset( static::$services[ ucwords($key) ] ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
return static::$services[ ucwords($key) ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @param \IPS\core\ShareLinks\Service $service The service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form, $service )
|
||||
{
|
||||
// Do nothing by default
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function __toString();
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief StumbleUpon share link
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Sept 2013
|
||||
* @see <a href='http://www.stumbleupon.com/dt/badges/create'>StumbleUpon button documentation</a>
|
||||
*/
|
||||
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* StumbleUpon share link
|
||||
* @note StumbleUpon does not provide a way to specify the language/locale
|
||||
*/
|
||||
class _Stumble
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any additional form elements to the configuration form. These must be setting keys that the service configuration form can save as a setting.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Configuration form for this service
|
||||
* @return void
|
||||
*/
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML code to show the share link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->stumble( urlencode( $this->url ) );
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\Content\ShareServices;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -21,31 +21,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Twitter share link
|
||||
*/
|
||||
class _Twitter
|
||||
class _Twitter extends \IPS\Content\ShareServices
|
||||
{
|
||||
/**
|
||||
* @brief URL to the content item
|
||||
*/
|
||||
protected $url = NULL;
|
||||
|
||||
/**
|
||||
* @brief Title of the content item
|
||||
*/
|
||||
protected $title = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL to the content [optional - if omitted, some services will figure out on their own]
|
||||
* @param string $title Default text for the content, usually the title [optional - if omitted, some services will figure out on their own]
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, $title=NULL )
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the logged in user has the ability to autoshare
|
||||
*
|
||||
@@ -65,7 +42,7 @@ class _Twitter
|
||||
*
|
||||
* @param string $content Text to publish
|
||||
* @param string $url [URL to publish]
|
||||
* @return @void
|
||||
* @return void
|
||||
*/
|
||||
public static function publish( $content, $url=null )
|
||||
{
|
||||
@@ -124,7 +101,7 @@ class _Twitter
|
||||
$url = preg_replace_callback( "{[^0-9a-z_.!~*'();,/?:@&=+$#-]}i",
|
||||
function ( $m )
|
||||
{
|
||||
return sprintf( '%%%02X', ord( $m[0] ) );
|
||||
return sprintf( '%%%02X', \ord( $m[0] ) );
|
||||
},
|
||||
$this->url) ;
|
||||
|
||||
|
||||
Reference in new issue
Block a user