2017-08-08 19:38:42 +01:00
< ? php
2021-12-07 22:14:12 -08:00
2017-08-08 19:38:42 +01:00
/*
2022-05-27 11:54:24 +03:00
* Made by Samerton
2017-08-08 19:38:42 +01:00
* https :// github . com / NamelessMC / Nameless /
2025-02-24 18:44:29 +00:00
* NamelessMC version 2.2 . 0
2017-08-08 19:38:42 +01:00
*
* License : MIT
*
* Facebook Widget
*/
2021-12-07 22:14:12 -08:00
2017-08-08 19:38:42 +01:00
class FacebookWidget extends WidgetBase {
2020-12-14 14:20:28 -08:00
2023-06-21 10:19:46 -07:00
private string $_fb_url ;
2025-02-24 18:44:29 +00:00
public function __construct ( TemplateEngine $engine , ? string $fb_url = '' ) {
$this -> _engine = $engine ;
2017-08-08 19:38:42 +01:00
// Set widget variables
2017-10-06 20:22:17 +01:00
$this -> _module = 'Core' ;
2017-08-08 19:38:42 +01:00
$this -> _name = 'Facebook' ;
2020-12-14 20:44:25 -08:00
$this -> _description = 'Display a feed from your Facebook page on your site. Make sure you have entered your Facebook URL in the StaffCP -> Core -> Social Media tab first!' ;
2017-08-08 19:38:42 +01:00
2023-06-21 10:19:46 -07:00
$this -> _fb_url = $fb_url ;
2017-08-08 19:38:42 +01:00
}
2018-09-10 01:14:58 +01:00
2021-10-31 15:41:14 +00:00
public function initialise () : void {
2023-06-21 10:19:46 -07:00
$this -> _content = '
< div id = " fb-root " ></ div >
< script >
( function ( d , s , id ) {
var js , fjs = d . getElementsByTagName ( s )[ 0 ];
if ( d . getElementById ( id )) return ;
js = d . createElement ( s ); js . id = id ;
js . src = " //connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.10 " ;
fjs . parentNode . insertBefore ( js , fjs );
}( document , \ ' script\ ' , \ ' facebook - jssdk\ ' ));
</ script >
< div class = " fb-page " data - href = " ' . Output::getClean( $this->_fb_url ) . ' " data - tabs = " timeline " data - small - header = " false " data - adapt - container - width = " true " data - hide - cover = " false " data - show - facepile = " true " >
< blockquote cite = " ' . Output::getClean( $this->_fb_url ) . ' " class = " fb-xfbml-parse-ignore " >
< a href = " ' . Output::getClean( $this->_fb_url ) . ' " > ' . Output::getClean(SITE_NAME) . ' </ a >
</ blockquote >
</ div > ' ;
2018-09-10 01:14:58 +01:00
}
2018-06-20 21:57:47 +03:00
}