Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -13,7 +13,9 @@ namespace IPS\forums\extensions\core\AdvertisementLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\core\Advertisement;
|
||||
use IPS\Extensions\AdvertisementLocationsAbstract;
|
||||
use IPS\Request;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -43,7 +45,7 @@ class ForumListing extends AdvertisementLocationsAbstract
|
||||
*/
|
||||
public function getSettings( array $settings ): array
|
||||
{
|
||||
return array( 'locations' => array( 'ad_forum_listing' => array() ), 'settings' => array() );
|
||||
return array( 'locations' => array( 'ad_forum_listing' => array( 'IPS_forums_Forum' ) ), 'settings' => array() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,4 +58,21 @@ class ForumListing extends AdvertisementLocationsAbstract
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the advertisement can be displayed, based on settings
|
||||
*
|
||||
* @param Advertisement $advertisement
|
||||
* @param string $location
|
||||
* @return bool
|
||||
*/
|
||||
public function canShow( Advertisement $advertisement, string $location ) : bool
|
||||
{
|
||||
if( isset( $advertisement->_additional_settings['IPS_forums_Forum'] ) and !in_array( Request::i()->id, $advertisement->_additional_settings['IPS_forums_Forum'] ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,11 @@ namespace IPS\forums\extensions\core\AdvertisementLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\core\Advertisement;
|
||||
use IPS\Extensions\AdvertisementLocationsAbstract;
|
||||
use IPS\forums\Topic;
|
||||
use IPS\Request;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -43,7 +47,7 @@ class TopicView extends AdvertisementLocationsAbstract
|
||||
*/
|
||||
public function getSettings( array $settings ): array
|
||||
{
|
||||
return array( 'locations' => array( 'ad_topic_view' => array() ), 'settings' => array() );
|
||||
return array( 'locations' => array( 'ad_topic_view' => array( 'IPS_forums_Forum' ) ), 'settings' => array() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,4 +60,28 @@ class TopicView extends AdvertisementLocationsAbstract
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the advertisement can be displayed, based on settings
|
||||
*
|
||||
* @param Advertisement $advertisement
|
||||
* @param string $location
|
||||
* @return bool
|
||||
*/
|
||||
public function canShow( Advertisement $advertisement, string $location ) : bool
|
||||
{
|
||||
if( isset( $advertisement->_additional_settings['IPS_forums_Forum'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
return in_array( Topic::load( Request::i()->id )->forum_id, $advertisement->_additional_settings['IPS_forums_Forum'] );
|
||||
}
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user