Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+19 -13
View File
@@ -11,7 +11,7 @@
namespace IPS\Content\Promote;
/* 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;
@@ -103,9 +103,9 @@ class _Facebook extends PromoteAbstract
return FALSE;
}
foreach( array( 'publish_to_groups', 'manage_pages', 'publish_pages' ) as $perm )
foreach( array( 'manage_pages', 'publish_pages' ) as $perm )
{
if ( ! in_array( $perm, $authorizedScopes ) )
if ( ! \in_array( $perm, $authorizedScopes ) )
{
return FALSE;
}
@@ -151,7 +151,7 @@ class _Facebook extends PromoteAbstract
}
else
{
if ( count( $this->settings['tags'] ) )
if ( \count( $this->settings['tags'] ) )
{
$_text .= '#' . implode( ' #', $this->settings['tags'] );
}
@@ -161,16 +161,22 @@ class _Facebook extends PromoteAbstract
$options = array();
if ( isset( $this->settings['shareable'] ) )
{
foreach( $this->settings['shareable']['pages'] as $id => $data )
if( isset( $this->settings['shareable']['pages'] ) )
{
$options[ 'p_' . $id ] = \IPS\Member::loggedIn()->language()->addToStack( 'promote_facebook_page_prefix', NULL, array( 'sprintf' => array( $data['name'] ) ) );
$names[] = $data['name'];
foreach( $this->settings['shareable']['pages'] as $id => $data )
{
$options[ 'p_' . $id ] = \IPS\Member::loggedIn()->language()->addToStack( 'promote_facebook_page_prefix', NULL, array( 'sprintf' => array( $data['name'] ) ) );
$names[] = $data['name'];
}
}
foreach( $this->settings['shareable']['groups'] as $id => $data )
if( isset( $this->settings['shareable']['groups'] ) )
{
$options[ 'g_' . $id ] = \IPS\Member::loggedIn()->language()->addToStack( 'promote_facebook_group_prefix', NULL, array( 'sprintf' => array( $data['name'] ) ) );
$names[] = $data['name'];
foreach( $this->settings['shareable']['groups'] as $id => $data )
{
$options[ 'g_' . $id ] = \IPS\Member::loggedIn()->language()->addToStack( 'promote_facebook_group_prefix', NULL, array( 'sprintf' => array( $data['name'] ) ) );
$names[] = $data['name'];
}
}
}
@@ -253,7 +259,7 @@ class _Facebook extends PromoteAbstract
$now = new \IPS\DateTime();
/* Only look back past the last 30 mins */
if ( intval( $now->diff( $time )->format('%i') ) > 30 )
if ( \intval( $now->diff( $time )->format('%i') ) > 30 )
{
continue;
}
@@ -271,7 +277,7 @@ class _Facebook extends PromoteAbstract
\IPS\Log::log( $e, 'facebook' );
}
if ( ! $photos or count( $photos ) === 1 )
if ( ! $photos or \count( $photos ) === 1 )
{
/* Simple message */
try
@@ -381,7 +387,7 @@ class _Facebook extends PromoteAbstract
*/
public function getUrl( $data )
{
if ( is_array( $data ) and count( $data ) )
if ( \is_array( $data ) and \count( $data ) )
{
/* Get a random URL from the many it was shared to */
$array = $data[ array_rand( $data ) ];