Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* @brief Bluesky 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 19 November 2024
*/
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;
}
/**
* Bluesky share link
*/
class _Bluesky extends \IPS\Content\ShareServices
{
/**
* Return the HTML code to show the share link
*
* @return string
*/
public function __toString()
{
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->bluesky( urlencode( $this->url ), $this->title ? urlencode( $this->title ) : NULL );
}
}
@@ -30,12 +30,13 @@ abstract class _ShareServices
public static function services()
{
return array(
'Bluesky' => 'IPS\Content\ShareServices\Bluesky',
'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',
'X' => 'IPS\Content\ShareServices\X',
);
}
@@ -1,12 +1,12 @@
<?php
/**
* @brief Twitter share link
* @brief X 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://dev.twitter.com/docs/tweet-button'>Tweet button documentation</a>
* @since 26 Sept 2023
* @see <a href='https://dev.x.com/docs/tweet-button'>X button documentation</a>
*/
namespace IPS\Content\ShareServices;
@@ -19,21 +19,17 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* Twitter share link
* X share link
*/
class _Twitter extends \IPS\Content\ShareServices
class _X extends \IPS\Content\ShareServices
{
/**
* Determine whether the logged in user has the ability to autoshare
*
* @return boolean
*/
public static function canAutoshare()
public static function canAutoshare(): bool
{
if ( $method = \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth1\Twitter' ) and $method->canProcess( \IPS\Member::loggedIn() ) )
{
return TRUE;
}
return FALSE;
}
@@ -46,25 +42,7 @@ class _Twitter extends \IPS\Content\ShareServices
*/
public static function publish( $content, $url=null )
{
if ( static::canAutoshare() and $method = \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth1\Twitter' ) )
{
try
{
if ( !$method->postToTwitter( \IPS\Member::loggedIn(), $content, $url ) )
{
throw new \Exception;
}
}
catch( \Exception $e )
{
\IPS\Log::log( \IPS\Member::loggedIn()->member_id . ': '. $e->getMessage(), 'twitter' );
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('twitter_publish_exception') );
}
}
else
{
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('twitter_publish_no_user') );
}
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('x_publish_no_user') );
}
/**
@@ -76,17 +54,7 @@ class _Twitter extends \IPS\Content\ShareServices
*/
public static function modifyForm( \IPS\Helpers\Form &$form, $service )
{
$form->add( new \IPS\Helpers\Form\Text( 'twitter_hashtag', \IPS\Settings::i()->twitter_hashtag, FALSE ) );
if ( \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth2\Twitter' ) )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'share_autoshare_Twitter', $service->autoshare, false ) );
}
else
{
$form->add( new \IPS\Helpers\Form\YesNo( 'share_autoshare_Twitter', FALSE, false, array( 'disabled' => TRUE ) ) );
\IPS\Member::loggedIn()->language()->words['share_autoshare_Twitter_desc'] = \IPS\Member::loggedIn()->language()->addToStack('share_autoshare_Twitter_disabled');
}
$form->add( new \IPS\Helpers\Form\Text( 'x_hashtag', \IPS\Settings::i()->x_hashtag, FALSE ) );
}
/**
@@ -106,11 +74,11 @@ class _Twitter extends \IPS\Content\ShareServices
$this->url) ;
$title = $this->title ?: NULL;
if ( \IPS\Settings::i()->twitter_hashtag !== '')
if ( \IPS\Settings::i()->x_hashtag !== '')
{
$title .= ' ' . \IPS\Settings::i()->twitter_hashtag;
$title .= ' ' . \IPS\Settings::i()->x_hashtag;
}
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->twitter( urlencode( $url ), rawurlencode( $title ) );
return \IPS\Theme::i()->getTemplate( 'sharelinks', 'core' )->x( urlencode( $url ), rawurlencode( $title ) );
}
catch ( \Exception $e )
{