Skip to content

Commit

Permalink
Added themes
Browse files Browse the repository at this point in the history
Added the possibility to select a theme and style the buttons by default
  • Loading branch information
fritzmg committed Nov 13, 2014
1 parent 1bd1e70 commit 9de78d5
Show file tree
Hide file tree
Showing 50 changed files with 277 additions and 4 deletions.
7 changes: 7 additions & 0 deletions system/modules/sharebuttons/assets/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions system/modules/sharebuttons/assets/sharebuttons_base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ul.sharebuttons {
list-style-type:none;
margin:0 -4px;
padding:0;
}

ul.sharebuttons:after {
content:"";
display:block;
clear:both;
}

ul.sharebuttons > li {
float:left;
margin:0 4px;
}

ul.sharebuttons > li > a {
display:block;
white-space:nowrap;
overflow:hidden;
text-indent:100%;
background-repeat:no-repeat;
background-position:center;
}
30 changes: 30 additions & 0 deletions system/modules/sharebuttons/assets/sharebuttons_shadow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* from http://wegraphics.net/downloads/free-long-shadow-social-media-icons/ */

ul.sharebuttons > li > a {
width:32px;
height:32px;
}

ul.sharebuttons > li > a.facebook {
background-image:url('shadow/facebook.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('shadow/twitter.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('shadow/gplus.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('shadow/linkedin.png');
}

ul.sharebuttons > li > a.xing {
display:none;
}

ul.sharebuttons > li > a.mail {
display:none;
}
30 changes: 30 additions & 0 deletions system/modules/sharebuttons/assets/sharebuttons_simpleflat.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* from http://simplesharingbuttons.com/ */

ul.sharebuttons > li > a {
width:32px;
height:32px;
}

ul.sharebuttons > li > a.facebook {
background-image:url('simpleflat/facebook.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('simpleflat/twitter.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('simpleflat/gplus.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('simpleflat/linkedin.png');
}

ul.sharebuttons > li > a.xing {
display:none;
}

ul.sharebuttons > li > a.mail {
background-image:url('simpleflat/email.png');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* from http://simpleicons.org/ */

ul.sharebuttons > li > a {
width:32px;
height:32px;
}

ul.sharebuttons > li > a.facebook {
background-image:url('simpleicons/facebook-32-black.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('simpleicons/twitter-32-black.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('simpleicons/googleplus-32-black.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('simpleicons/linkedin-32-black.png');
}

ul.sharebuttons > li > a.xing {
background-image:url('simpleicons/xing-32-black.png');
}

ul.sharebuttons > li > a.mail {
background-image:url('simpleicons/email-32-black.png');
}

@media only screen and (max-width:768px) {

ul.sharebuttons > li > a {
background-size:100% auto;
}

ul.sharebuttons > li > a.facebook {
background-image:url('simpleicons/facebook-64-black.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('simpleicons/twitter-64-black.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('simpleicons/googleplus-64-black.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('simpleicons/linkedin-64-black.png');
}

ul.sharebuttons > li > a.xing {
background-image:url('simpleicons/xing-64-black.png');
}

ul.sharebuttons > li > a.mail {
background-image:url('simpleicons/email-64-black.png');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* from http://simpleicons.org/ */

ul.sharebuttons > li > a {
width:32px;
height:32px;
}

ul.sharebuttons > li > a.facebook {
background-image:url('simpleicons/facebook-32.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('simpleicons/twitter-32.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('simpleicons/googleplus-32.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('simpleicons/linkedin-32.png');
}

ul.sharebuttons > li > a.xing {
background-image:url('simpleicons/xing-32.png');
}

ul.sharebuttons > li > a.mail {
background-image:url('simpleicons/email-32.png');
}

@media only screen and (max-width:768px) {

ul.sharebuttons > li > a {
background-size:100% auto;
}

ul.sharebuttons > li > a.facebook {
background-image:url('simpleicons/facebook-64.png');
}

ul.sharebuttons > li > a.twitter {
background-image:url('simpleicons/twitter-64.png');
}

ul.sharebuttons > li > a.gplus {
background-image:url('simpleicons/googleplus-64.png');
}

ul.sharebuttons > li > a.linkedin {
background-image:url('simpleicons/linkedin-64.png');
}

ul.sharebuttons > li > a.xing {
background-image:url('simpleicons/xing-64.png');
}

ul.sharebuttons > li > a.mail {
background-image:url('simpleicons/email-64.png');
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions system/modules/sharebuttons/classes/ModuleShareButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ protected function compile()
$this->Template->linkedin = $this->sharebuttons_linkedin;
$this->Template->xing = $this->sharebuttons_xing;
$this->Template->mail = $this->sharebuttons_mail;
$this->Template->usetheme = $this->sharebuttons_usetheme;
$this->Template->theme = $this->sharebuttons_theme;

if( $this->sharebuttons_usetheme && TL_MODE == 'FE' )
{
if( !is_array( $GLOBALS['TL_CSS'] ) ) $GLOBALS['TL_CSS'] = array();
$GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/sharebuttons_base.css';
$GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/'.$this->sharebuttons_theme.'.css';
}
}
}
?>
24 changes: 23 additions & 1 deletion system/modules/sharebuttons/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
/**
* Add palettes to tl_module
*/
$GLOBALS['TL_DCA']['tl_module']['palettes']['sharebuttons'] = '{title_legend},name,headline,type;{sharebuttons_legend},sharebuttons_facebook,sharebuttons_twitter,sharebuttons_gplus,sharebuttons_linkedin,sharebuttons_xing,sharebuttons_mail,sharebuttons_template;{expert_legend},cssID,align,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'sharebuttons_usetheme';
$GLOBALS['TL_DCA']['tl_module']['palettes']['sharebuttons'] = '{title_legend},name,headline,type;{sharebuttons_legend},sharebuttons_facebook,sharebuttons_twitter,sharebuttons_gplus,sharebuttons_linkedin,sharebuttons_xing,sharebuttons_mail,sharebuttons_template;{sharebuttons_theme_legend},sharebuttons_usetheme;{expert_legend},cssID,align,space';
$GLOBALS['TL_DCA']['tl_module']['subpalettes']['sharebuttons_usetheme'] = 'sharebuttons_theme';

/**
* Add fields to tl_module
Expand Down Expand Up @@ -93,6 +95,26 @@
'sql' => "varchar(32) NOT NULL default 'sharebuttons_default'"
);

$GLOBALS['TL_DCA']['tl_module']['fields']['sharebuttons_usetheme'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['sharebuttons_usetheme'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('submitOnChange'=>true),
'sql' => "char(1) NOT NULL default ''"
);

$GLOBALS['TL_DCA']['tl_module']['fields']['sharebuttons_theme'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['sharebuttons_theme'],
'exclude' => true,
'inputType' => 'select',
'options' => array('sharebuttons_shadow','sharebuttons_simpleflat','sharebuttons_simpleicons_white','sharebuttons_simpleicons_black'),
'reference' => &$GLOBALS['TL_LANG']['tl_module'],
'default' => 'sharebuttons_shadow',
'sql' => "varchar(32) NOT NULL default ''"
);

class tl_sharebuttons_module extends Backend
{
public function getSharebuttonsTemplates(DataContainer $dc)
Expand Down
9 changes: 9 additions & 0 deletions system/modules/sharebuttons/languages/de/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_mail'] = array('Zeige E-Mail','Zeige e-mail teilen button');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_template'] = array('Template','Verwendetes Frontend Template. Beginnt mit sharebuttons_');

$GLOBALS['TL_LANG']['tl_module']['sharebuttons_theme_legend'] = "Theme";

$GLOBALS['TL_LANG']['tl_module']['sharebuttons_usetheme'] = array('Theme benutzen','Integriert CSS files für das styling der buttons');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_theme'] = array('Theme','Wähle ein Theme aus, das für die buttons verwendet wird');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_shadow'] = 'Shadow';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleflat'] = 'Simple Flat';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleicons_white'] = 'Simple Icons White';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleicons_black'] = 'Simple Icons Black';

?>
9 changes: 9 additions & 0 deletions system/modules/sharebuttons/languages/en/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_mail'] = array('Enable E-Mail','Enable e-mail share button');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_template'] = array('Template','Used Template for frontend rendering. Starts with sharebuttons_');

$GLOBALS['TL_LANG']['tl_module']['sharebuttons_theme_legend'] = "Theme";

$GLOBALS['TL_LANG']['tl_module']['sharebuttons_usetheme'] = array('Use theme','Integrates CSS files to style the buttons');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_theme'] = array('Theme','Choose a theme for the buttons');
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_shadow'] = 'Shadow';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleflat'] = 'Simple Flat';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleicons_white'] = 'Simple Icons White';
$GLOBALS['TL_LANG']['tl_module']['sharebuttons_simpleicons_black'] = 'Simple Icons Black';

?>
16 changes: 13 additions & 3 deletions system/modules/sharebuttons/templates/sharebuttons_default.html5
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<ul class="share">
<?php

if( $this->usetheme )
{
$GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/sharebuttons_base.css';
$GLOBALS['TL_CSS'][] = 'system/modules/sharebuttons/assets/'.$this->theme.'.css';
}

?>

<ul class="sharebuttons">
<?php if ($this->facebook): ?>
<li class="first"><a class="facebook" href="share/index.php?p=facebook[&]u=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>[&]t=<?php echo urlencode($objPage->pageTitle); ?>" rel="nofollow" title="{{label::sharebuttons:share_on_facebook}}" onclick="window.open(this.href, '', 'width=760,height=470,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); return false;">Facebook</a></li>
<li><a class="facebook" href="share/index.php?p=facebook[&]u=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>[&]t=<?php echo urlencode($objPage->pageTitle); ?>" rel="nofollow" title="{{label::sharebuttons:share_on_facebook}}" onclick="window.open(this.href, '', 'width=760,height=470,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); return false;">Facebook</a></li>
<?php endif; ?>
<?php if ($this->twitter): ?>
<li><a class="twitter" href="share/index.php?p=twitter[&]u=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>[&]t=<?php echo urlencode($objPage->pageTitle); ?>" rel="nofollow" title="{{label::sharebuttons:share_on_twitter}}" onclick="window.open(this.href, '', 'width=760,height=470,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); return false;">Twitter</a></li>
Expand All @@ -15,6 +25,6 @@
<li><a class="xing" href="https://www.xing.com/app/user?op=share;url=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>" rel="nofollow" title="{{label::sharebuttons:share_on_xing}}" target="blank">Xing</a></li>
<?php endif; ?>
<?php if ($this->mail): ?>
<li class="last"><a class="mail" href="mailto:?subject={{label::sharebuttons:mail_subject}}:%20<?php echo urlencode($objPage->pageTitle); ?>[&]body=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>">Mail</a></li>
<li><a class="mail" href="mailto:?subject={{label::sharebuttons:mail_subject}}:%20<?php echo urlencode($objPage->pageTitle); ?>[&]body=<?php echo urlencode($this->Environment->base . $this->Environment->request); ?>">Mail</a></li>
<?php endif; ?>
</ul>

0 comments on commit 9de78d5

Please sign in to comment.