diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index f318e2699..98e0fcab1 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -740,9 +740,14 @@ class page_admin_ui extends e_admin_ui } + function afterDelete() //TODO Delete Menu item. + { + } + + } diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 964ee3297..bdb56ee30 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -1401,94 +1401,6 @@ $text .= " // =========== Registration Preferences. ================== -// Single/ Social Login / / copied from hybridAuth config.php so it's easy to add more. -// Used Below. - -$social_logins = array ( - // openid providers - "OpenID" => array ( - "enabled" => true - ), - - "Yahoo" => array ( - "enabled" => true - ), - - "AOL" => array ( - "enabled" => true - ), - - "Facebook" => array ( - "enabled" => true, - "keys" => array ( "id" => "", "secret" => "" ), - "trustForwarded" => false, - // A comma-separated list of permissions you want to request from the user. See the Facebook docs for a full list of available permissions: http://developers.facebook.com/docs/reference/api/permissions. - "scope" => "", - - // The display context to show the authentication page. Options are: page, popup, iframe, touch and wap. Read the Facebook docs for more details: http://developers.facebook.com/docs/reference/dialogs#display. Default: page - "display" => "" - ), - - "Foursquare" => array ( - "enabled" => true, - "keys" => array ( "id" => "", "secret" => "" ) - ), - - "Github" => array ( - "enabled" => true, - "keys" => array ( "id" => "", "secret" => "" ) - ), - - "Google" => array ( - "enabled" => true, - "keys" => array ( "id" => "", "secret" => "" ), - "scope" => "" - ), - - "LinkedIn" => array ( - "enabled" => true, - "keys" => array ( "key" => "", "secret" => "" ) - ), - - // windows live - "Live" => array ( - "enabled" => true, - "keys" => array ( "id" => "", "secret" => "" ) - ), - - /* - "MySpace" => array ( - "enabled" => true, - "keys" => array ( "key" => "", "secret" => "" ) - ), - */ - - "Twitter" => array ( - "enabled" => true, - "keys" => array ( "key" => "", "secret" => "" ) - ), - - - - - - - - - ); - - -$social_external = array( - "Facebook" => "https://developers.facebook.com/apps", - "Twitter" => "https://dev.twitter.com/apps/new", - "Google" => "https://code.google.com/apis/console/", - "Live" => "https://manage.dev.live.com/ApplicationOverview.aspx", - "LinkedIn" => "https://www.linkedin.com/secure/developer", - "Foursquare" => "https://www.foursquare.com/oauth/", - "Github" => "https://github.com/settings/applications/new", -); - -$testUrl = SITEURL."?route=system/xup/test"; $elements = array(1=>'Register & Login', 2=> 'Login Only', 0=>LAN_DISABLED); @@ -1501,7 +1413,7 @@ $text .= " - + @@ -1509,8 +1421,8 @@ $text .= "
".PRFLAN_30."
- - + + @@ -1604,91 +1516,9 @@ $text .= " - "; + - - $text .= " - - - - - - ".$frm->radio_switch('social_login_active', $pref['social_login_active'])." -
Allows users to signup/login with their social media accounts. When enabled, this option will still allow users to signup/login even if the core user registration system above is disabled.
- - - - - -
Note: In most cases you will need to obtain an id and secret key from one of the providers. Click the blue links below to configure. -
You may test your configuration with the following URL: - ".$testUrl."
- - - - "; - - if(!is_array($pref['social_login'])) - { - $pref['social_login'] = array(); - } - - foreach($social_logins as $prov=>$val) - { - - $label = varset($social_external[$prov]) ? "".$prov."" : $prov; - $radio_label = strtolower($prov); - $text .= " - - - - "; - foreach($val as $k=>$v) - { - switch ($k) { - case 'enabled': - $eopt = array('class'=>'e-expandit'); - $text .= $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); - break; - - case 'keys': - // $cls = vartrue($pref['single_login'][$prov]['keys'][$tk]) ? "class='e-hideme'" : ''; - $sty = vartrue($pref['social_login'][$prov]['keys'][vartrue($tk)]) ? "" : "e-hideme"; - $text .= "
"; - foreach($v as $tk=>$idk) - { - $eopt = array('placeholder'=> $tk, 'size'=>'xxlarge'); - $text .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt); - } - $text .= "
"; - - break; - - case 'scope': - $text .= $frm->hidden('social_login['.$prov.'][scope]','email'); - break; - - default: - - break; - } - } - - $text .= " - - "; - } - - - - - - - - $text .= " - - - + ".pref_submit('registration')." @@ -1699,63 +1529,6 @@ $text .= " // Key registration // TODO LAN - -$text .= " -
- Social Options - - - - - - - - - - "; - -//XXX XURL Definitions. -$xurls = array( - 'facebook' => array('label'=>"Facebook", "placeholder"=>"eg. https://www.facebook.com/e107CMS"), - 'twitter' => array('label'=>"Twitter", "placeholder"=>"eg. https://twitter.com/e107"), - 'youtube' => array('label'=>"Youtube", "placeholder"=>"eg.https://youtube.com/e107Inc"), - 'google' => array('label'=>"Google+", "placeholder"=>""), - 'linkedin' => array('label'=>"LinkedIn", "placeholder"=>"eg. http://www.linkedin.com/groups?home=&gid=1782682"), - 'github' => array('label'=>"Github", "placeholder"=>"eg. https://github.com/e107inc"), - 'flickr' => array('label'=>"Flickr", "placeholder"=>""), - 'instagram' => array('label'=>"Instagram", "placeholder"=>""), - 'pinterest' => array('label'=>"Pinterest", "placeholder"=>""), - 'vimeo' => array('label'=>"Vimeo", "placeholder"=>""), -); - - foreach($xurls as $k=>$var) - { - $keypref = "xurl[".$k."]"; - $text_label = "xurl-".$k.""; - $def = "XURL_". strtoupper($k); - - $opts = array('size'=>'xxlarge','placeholder'=> $var['placeholder']); - - $text .= " - - - - - "; - } - - - - -$text .= " - -
External Social Pages
- ".$frm->text($keypref, $pref['xurl'][$k], false, $opts)." -
Used by some themes to provide a link to your ".$var['label']." page. (".$def.")
-
- ".pref_submit('sociallogin')." -
-"; @@ -2670,7 +2443,7 @@ function prefs_adminmenu() $var['core-prefs-email']['text'] = "Email & Contact Info"; $var['core-prefs-registration']['text'] = PRFLAN_28; $var['core-prefs-signup']['text'] = PRFLAN_19; - $var['core-prefs-sociallogin']['text'] = "Social Options"; +// $var['core-prefs-sociallogin']['text'] = "Social Options"; // Moved into plugin. $var['core-prefs-comments']['text'] = PRFLAN_210; $var['core-prefs-uploads']['text'] = "File Uploading"; // TODO LAN diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index a4d2c934b..b767786ed 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -137,6 +137,12 @@ class admin_shortcodes $ns = e107::getRender(); $pref = e107::getPref(); + + if($tmp = e107::getRegistry('core/e107/adminui/help')) + { + return $ns->tablerender($tmp['caption'],$tmp['text'],'e_help',true); + } + if(function_exists('e_help') && ($tmp = e_help())) // new in v2.x for non-admin-ui admin pages. { diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index af0f1fc35..f862d0731 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -30,6 +30,8 @@ class news_shortcodes extends e_shortcode //protected $param; - shouldn't be set - see __set/__get methods of e_shortcode & news::render_newsitem() protected $commentsDisabled; + + protected $commentsEngine = 'e107'; private $imageItem; @@ -42,6 +44,11 @@ class news_shortcodes extends e_shortcode $pref = e107::getPref(); $this->commentsDisabled = vartrue($pref['comments_disabled']); + + if(!empty($pref['comments_engine'])) + { + $this->commentsEngine = $pref['comments_engine']; + } } function sc_newstitle() @@ -269,9 +276,9 @@ class news_shortcodes extends e_shortcode */ function sc_newscommentcount($parm='') { - if($this->commentsDisabled) + if($this->commentsDisabled || ($this->commentsEngine != 'e107')) { - return; + return; } $text = varset($parm['glyph']) ? e107::getParser()->toGlyph($parm['glyph']) : ""; diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 151c82b62..53aff5886 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -1541,8 +1541,8 @@ class e_admin_dispatcher */ function renderHelp() { - - + + } @@ -4142,6 +4142,17 @@ class e_admin_ui extends e_admin_controller_ui $this->addTitle($this->pluginTitle, true)->parseAliases(); $this->initAdminAddons(); + + + if($help = $this->renderHelp()) + { + if(!empty($help)) + { + e107::setRegistry('core/e107/adminui/help',$help); + } + } + + } @@ -5133,6 +5144,8 @@ class e_admin_ui extends e_admin_controller_ui { } + + /** * User defined after-update logic * @param $new_data diff --git a/e107_plugins/social/admin_config.php b/e107_plugins/social/admin_config.php index f3c1d61c9..831da5879 100644 --- a/e107_plugins/social/admin_config.php +++ b/e107_plugins/social/admin_config.php @@ -30,10 +30,10 @@ class social_adminarea extends e_admin_dispatcher // 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'), // 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'), - + 'main/configure' => array('caption'=> LAN_CONFIGURE, 'perm' => 'P'), 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'), - // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P') + ); protected $adminMenuAliases = array( @@ -71,21 +71,127 @@ class social_ui extends e_admin_ui protected $fieldpref = array(); - protected $preftabs = array('Twitter Menu'); + protected $preftabs = array('Facebook Comments', 'Twitter Menu'); protected $prefs = array( - 'twitter_menu_height' => array('title'=> 'Height', 'type'=>'number', 'tab'=>0, 'data' => 'int','help'=>'Height in px'), - 'twitter_menu_limit' => array('title'=> 'Limit', 'type'=>'number', 'tab'=>0, 'data' => 'int','help'=>'Number of tweets to display.'), + + + 'facebook_comments_limit' => array('title'=> 'Limit', 'type'=>'number', 'tab'=>0, 'data' => 'int','help'=>'Number of tweets to display.'), + 'facebook_comments_theme' => array('title'=> 'Theme', 'type'=>'dropdown', 'tab'=>0, 'writeParms'=>array('optArray'=>array('light'=>'Light','dark'=>'Dark')), 'data' => 'int','help'=>'Number of tweets to display.'), + 'facebook_comments_loadingtext' => array('title'=> 'Text while loading', 'type'=>'text', 'tab'=>0, 'data' => 'int', 'writeParms'=>array('placeholder'=>'Loading...'), 'help'=>'Number of tweets to display.'), + + 'twitter_menu_height' => array('title'=> 'Height', 'type'=>'number', 'tab'=>1, 'data' => 'int','help'=>'Height in px'), + 'twitter_menu_limit' => array('title'=> 'Limit', 'type'=>'number', 'tab'=>1, 'data' => 'int','help'=>'Number of tweets to display.'), ); - + protected $social_logins = array(); + + protected $social_external = array(); + public function init() { + if(!empty($_POST['save_social']) ) + { + $cfg = e107::getConfig(); + + $cfg->setPref('social_login', $_POST['social_login']); + $cfg->setPref('social_login_active', $_POST['social_login_active']); + $cfg->setPref('xurl', $_POST['xurl']); + $cfg->save(true, true, true); + + } + + +// Single/ Social Login / / copied from hybridAuth config.php so it's easy to add more. +// Used Below. + + $this->social_logins = array ( + // openid providers + "OpenID" => array ( + "enabled" => true + ), + + "Yahoo" => array ( + "enabled" => true + ), + + "AOL" => array ( + "enabled" => true + ), + + "Facebook" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ), + "trustForwarded" => false, + // A comma-separated list of permissions you want to request from the user. See the Facebook docs for a full list of available permissions: http://developers.facebook.com/docs/reference/api/permissions. + "scope" => "", + + // The display context to show the authentication page. Options are: page, popup, iframe, touch and wap. Read the Facebook docs for more details: http://developers.facebook.com/docs/reference/dialogs#display. Default: page + "display" => "" + ), + + "Foursquare" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ) + ), + + "Github" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ) + ), + + "Google" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ), + "scope" => "" + ), + + "LinkedIn" => array ( + "enabled" => true, + "keys" => array ( "key" => "", "secret" => "" ) + ), + + // windows live + "Live" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ) + ), + + /* + "MySpace" => array ( + "enabled" => true, + "keys" => array ( "key" => "", "secret" => "" ) + ), + */ + + "Twitter" => array ( + "enabled" => true, + "keys" => array ( "key" => "", "secret" => "" ) + ), + + + + + + + + + ); + + + $this->social_external = array( + "Facebook" => "https://developers.facebook.com/apps", + "Twitter" => "https://dev.twitter.com/apps/new", + "Google" => "https://code.google.com/apis/console/", + "Live" => "https://manage.dev.live.com/ApplicationOverview.aspx", + "LinkedIn" => "https://www.linkedin.com/secure/developer", + "Foursquare" => "https://www.foursquare.com/oauth/", + "Github" => "https://github.com/settings/applications/new", + ); - // print_a($this->fields); } @@ -124,17 +230,196 @@ class social_ui extends e_admin_ui // do something } - - /* + function renderHelp() + { + $this->testUrl = SITEURL."?route=system/xup/test"; + + $notice = "Note: In most cases you will need to obtain an id and secret key from one of the providers. Click the blue links below to configure. +
You may test your configuration with the following URL: ".$this->testUrl.""; + + return array("caption"=>"Help",'text'=> $notice); + + } + // optional - a custom page. - public function customPage() + public function configurePage() { $ns = e107::getRender(); - $text = 'Hello World!'; - $ns->tablerender('Hello',$text); - + $frm = e107::getForm(); + $pref = e107::pref('core'); + + + + + // e107::getMessage()->addInfo($notice); + + + $text = " + + + + + + + + + + + + + + + + +
+ + ".$frm->radio_switch('social_login_active', $pref['social_login_active'])." +
Allows users to signup/login with their social media accounts. When enabled, this option will still allow users to signup/login even if the core user registration system above is disabled.
+ +
Application Keys and IDs
+ + + + + + + "; + + if(!is_array($pref['social_login'])) + { + $pref['social_login'] = array(); + } + + foreach($this->social_logins as $prov=>$val) + { + + $label = varset($this->social_external[$prov]) ? "".$prov."" : $prov; + $radio_label = strtolower($prov); + $text .= " + + + + + "; + } + + + + + + + + $text .= "
+ "; + foreach($val as $k=>$v) + { + switch ($k) { + case 'enabled': + $eopt = array('class'=>'e-expandit'); + $text .= $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); + break; + + case 'keys': + // $cls = vartrue($pref['single_login'][$prov]['keys'][$tk]) ? "class='e-hideme'" : ''; + $sty = vartrue($pref['social_login'][$prov]['keys'][vartrue($tk)]) ? "" : "e-hideme"; + $text .= "
"; + foreach($v as $tk=>$idk) + { + $eopt = array('placeholder'=> $tk, 'size'=>'xxlarge'); + $text .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt); + } + $text .= "
"; + + break; + + case 'scope': + $text .= $frm->hidden('social_login['.$prov.'][scope]','email'); + break; + + default: + + break; + } + } + + $text .= "
+
+ "; + + + + // ------------------------------- + // + // + + + $text2 = " + + + + + + + "; + +//XXX XURL Definitions. + $xurls = array( + 'facebook' => array('label'=>"Facebook", "placeholder"=>"eg. https://www.facebook.com/e107CMS"), + 'twitter' => array('label'=>"Twitter", "placeholder"=>"eg. https://twitter.com/e107"), + 'youtube' => array('label'=>"Youtube", "placeholder"=>"eg.https://youtube.com/e107Inc"), + 'google' => array('label'=>"Google+", "placeholder"=>""), + 'linkedin' => array('label'=>"LinkedIn", "placeholder"=>"eg. http://www.linkedin.com/groups?home=&gid=1782682"), + 'github' => array('label'=>"Github", "placeholder"=>"eg. https://github.com/e107inc"), + 'flickr' => array('label'=>"Flickr", "placeholder"=>""), + 'instagram' => array('label'=>"Instagram", "placeholder"=>""), + 'pinterest' => array('label'=>"Pinterest", "placeholder"=>""), + 'vimeo' => array('label'=>"Vimeo", "placeholder"=>""), + ); + + foreach($xurls as $k=>$var) + { + $keypref = "xurl[".$k."]"; + $text_label = "xurl-".$k.""; + $def = "XURL_". strtoupper($k); + + $opts = array('size'=>'xxlarge','placeholder'=> $var['placeholder']); + + $text2 .= " + + + + + "; + } + + + + + $text2 .= " + +
+ ".$frm->text($keypref, $pref['xurl'][$k], false, $opts)." +
Used by some themes to provide a link to your ".$var['label']." page. (".$def.")
+
+ +"; + $tabs = array(); + $tabs[] = array('caption'=>"Apps", 'text'=>$text); + $tabs[] = array('caption'=>'Pages', 'text'=>$text2); + + $ret = $frm->open('social','post',null, 'class=form-horizontal').$frm->tabs($tabs); + + $ret .= "
+ + ".$frm->button('save_social',1,'submit',LAN_SAVE)." + +
"; + + $ret .= $frm->close(); + + return $ret; } - */ + } diff --git a/e107_plugins/social/e_comment.php b/e107_plugins/social/e_comment.php index 76e98454f..bd14141be 100644 --- a/e107_plugins/social/e_comment.php +++ b/e107_plugins/social/e_comment.php @@ -81,9 +81,12 @@ class social_comment $link = e_REQUEST_URL; } + $pref = e107::pref('social'); + $limit = vartrue($pref['facebook_comments_limit'], 10); + $theme = vartrue($pref['facebook_comments_theme'], 'light'); + $loading = vartrue($pref['facebook_comments_loadingtext'], 'Loading...'); - //TODO Consider adding prefs to colorscheme and number of posts to the social admin area. - $text = '
Loading...
'; + $text = '
'.$loading.'
'; return $text; } diff --git a/e107_plugins/social/e_header.php b/e107_plugins/social/e_header.php index 69d34d017..27cbcfac8 100644 --- a/e107_plugins/social/e_header.php +++ b/e107_plugins/social/e_header.php @@ -3,6 +3,15 @@ if(USER_AREA) { e107::css('social', 'css/fontello.css'); + + $social = e107::pref('core','social_login'); + $appID = vartrue($social['Facebook']['keys']['id']); + + if(!empty($appID)) + { + e107::meta('fb:app_id', $appID); + } + } diff --git a/e107_plugins/social/plugin.xml b/e107_plugins/social/plugin.xml index 12d0bcb6f..ef0ddefcb 100644 --- a/e107_plugins/social/plugin.xml +++ b/e107_plugins/social/plugin.xml @@ -1,6 +1,13 @@ - - misc + + settings + + Adds Facebook, Twitter and other social media widgets to e107. + Adds options to replace the e107 comment engine with Facebook. Add Twitter feeds to your site. etc. + + facebook + twitter + LAN_CONFIGURE