Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -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 ) ];
|
||||
|
||||
@@ -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;
|
||||
@@ -39,7 +39,21 @@ class _Internal extends PromoteAbstract
|
||||
*/
|
||||
public function getPhoto()
|
||||
{
|
||||
return \IPS\Theme::i()->settings['logo_sharer'] ? \IPS\Theme::i()->settings['logo_sharer'] : \IPS\Theme::i()->settings['logo_front'];
|
||||
$shareLogos = \IPS\Settings::i()->icons_sharer_logo ? json_decode( \IPS\Settings::i()->icons_sharer_logo, true ) : array();
|
||||
|
||||
if( \count( $shareLogos ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
return (string) \IPS\File::get( 'core_Icons', $shareLogos[0] )->url->setScheme( ( \IPS\Request::i()->isSecure() ) ? 'https' : 'http' );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->settings['logo_front'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
@@ -26,6 +26,12 @@ abstract class _PromoteAbstract extends \IPS\Patterns\ActiveRecord
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
protected static $multitons;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Caches
|
||||
* @note Defined cache keys will be cleared automatically as needed
|
||||
*/
|
||||
protected $caches = array( 'promoters' );
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Database Table
|
||||
@@ -199,17 +205,4 @@ abstract class _PromoteAbstract extends \IPS\Patterns\ActiveRecord
|
||||
$this->settings = json_encode( array_merge( $this->settings, $settings ) );
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* [ActiveRecord] Save Changed Columns
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
parent::save();
|
||||
unset( \IPS\Data\Store::i()->promoters );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -131,7 +131,7 @@ class _Twitter extends PromoteAbstract
|
||||
if ( mb_strlen( $textToActuallyUse ) < 280 )
|
||||
{
|
||||
/* Got any tags to add? */
|
||||
if ( count( $this->settings['tags'] ) )
|
||||
if ( \count( $this->settings['tags'] ) )
|
||||
{
|
||||
if ( $this->settings['tags_method'] === 'trim' )
|
||||
{
|
||||
@@ -195,7 +195,7 @@ class _Twitter extends PromoteAbstract
|
||||
$photos = $promote->imageObjects();
|
||||
$mediaIds = array();
|
||||
|
||||
if ( count( $photos ) )
|
||||
if ( \count( $photos ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -230,7 +230,7 @@ class _Twitter extends PromoteAbstract
|
||||
{
|
||||
$send = array( 'status' => $promote->text['twitter'] );
|
||||
|
||||
if ( count( $mediaIds ) )
|
||||
if ( \count( $mediaIds ) )
|
||||
{
|
||||
$send['media_ids'] = implode( ',', $mediaIds );
|
||||
}
|
||||
|
||||
Whitespace-only changes.
Reference in new issue
Block a user