From d6693b24f41942fa0cb524f952834cde47f4c590 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sat, 3 Aug 2013 13:49:03 +0100 Subject: [PATCH] Fix PHPCS warnings and Update version to 1.3.1 --- changelog.php | 7 +- mod_social_slider/mod_social_slider.php | 181 +++++++++++++----------- mod_social_slider/mod_social_slider.xml | 3 +- mod_social_slider/tmpl/default.php | 60 ++++---- 4 files changed, 139 insertions(+), 112 deletions(-) diff --git a/changelog.php b/changelog.php index 8f74a85..236c957 100644 --- a/changelog.php +++ b/changelog.php @@ -1,5 +1,5 @@ @@ -15,6 +15,11 @@ - -> Removed ! -> Note +Version 1.3.1 +# Bug fix for some users unable to open LastFM and Google+ tabs +^ PHPCS fixes to Joomla Standards ++ Max-width and target parameters added + Version 1.3.0 + Added ability to use jQuery instead of CSS3 animations diff --git a/mod_social_slider/mod_social_slider.php b/mod_social_slider/mod_social_slider.php index 0655c45..7b77059 100644 --- a/mod_social_slider/mod_social_slider.php +++ b/mod_social_slider/mod_social_slider.php @@ -1,56 +1,69 @@ +* @copyright Copyright (C) 2011 - 2013 JoomJunk. All Rights Reserved +* @license GPL v3.0 or later http://www.gnu.org/licenses/gpl-3.0.html */ -// no direct access -defined( '_JEXEC' ) or die( 'Restricted access' ); +// No direct access +defined('_JEXEC') or die('Restricted access'); $document = JFactory::getDocument(); -if($params->get('jquery_css') == 0){ - if(version_compare(JVERSION,'3.0.0','ge')) { +if ($params->get('jquery_css') == 0) +{ + if (version_compare(JVERSION, '3.0.0', 'ge')) + { JHtml::_('jquery.framework'); } else { - if($params->get('jquery') == 0){ - if(!JFactory::getApplication()->get('jquery')){ - JFactory::getApplication()->set('jquery',true); + if ($params->get('jquery') == 0) + { + if (!JFactory::getApplication()->get('jquery')) + { + JFactory::getApplication()->set('jquery', true); $document->addScript("http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"); } } - elseif($params->get('jquery') == 1){ - if(!JFactory::getApplication()->get('jquery')){ - JFactory::getApplication()->set('jquery',true); + elseif ($params->get('jquery') == 1) + { + if (!JFactory::getApplication()->get('jquery')) + { + JFactory::getApplication()->set('jquery', true); $document->addScript(JUri::root() . "modules/mod_social_slider/assets/jquery.js"); } } } } -$style1 = 'ul#jj_sl_navigation li a {' +$style1 = 'ul#jj_sl_navigation li a {' . 'background-color:#' . $params->get('slide_colour') . ';' . 'text-align:' . $params->get('position') . ';' . '}'; $document->addStyleDeclaration($style1); -if ($params->get('disable') == 1) { - $mobile = '@media screen and (max-width: ' . $params->get("mobile_width", "480px") . '){' + +if ($params->get('disable') == 1) +{ + $mobile = '@media screen and (max-width: ' . $params->get("mobile_width", "480px") . '){' . 'ul#jj_sl_navigation { display: none; }' . '}'; -$document->addStyleDeclaration($mobile); + $document->addStyleDeclaration($mobile); } -if ($params->get('disable') == 2) { - $mobile_tablet = '@media screen and (max-width: ' . $params->get("tablet_width", "768px") . '){' + +if ($params->get('disable') == 2) +{ + $mobile_tablet = '@media screen and (max-width: ' . $params->get("tablet_width", "768px") . '){' . 'ul#jj_sl_navigation { display: none; }' . '}'; -$document->addStyleDeclaration($mobile_tablet); + $document->addStyleDeclaration($mobile_tablet); } -if ($params->get('position') == "left") { - if($params->get('jquery_css') == 0){ + +if ($params->get('position') == "left") +{ + if ($params->get('jquery_css') == 0) + { $js_left = ' (function($){ $(function() { @@ -69,8 +82,10 @@ function () { $css = ''; $document->addScriptDeclaration($js_left); } - if($params->get('jquery_css') == 1){ - $css='ul#jj_sl_navigation li { ' + + if ($params->get('jquery_css') == 1) + { + $css = 'ul#jj_sl_navigation li { ' . 'margin-left: -140px;' . '-webkit-transition: margin-left 0.3s;' . '-moz-transition: margin-left 0.3s;' @@ -79,8 +94,9 @@ function () { . 'transition: margin-left 0.3s;' . '}'; } + $style = 'ul#jj_sl_navigation { ' - . $params->get('position') .':0px;' + . $params->get('position') . ':0px;' . 'top:' . $params->get('top') . 'px;' . '}' . 'ul#jj_sl_navigation li:hover { ' @@ -94,86 +110,87 @@ function () { . 'background-position: 144px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/facebook-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .twitter a {' + . 'ul#jj_sl_navigation .twitter a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/twitter-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .google a {' + . 'ul#jj_sl_navigation .google a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/google-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .myspace a {' + . 'ul#jj_sl_navigation .myspace a {' . 'background-position: 144px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/myspace-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .youtube a {' + . 'ul#jj_sl_navigation .youtube a {' . 'background-position: 144px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/youtube-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .linkedin a {' + . 'ul#jj_sl_navigation .linkedin a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/linkedin-' . $params->get('icon_colour') . '.png);' - . '}' - .'ul#jj_sl_navigation .steam a {' + . '}' + . 'ul#jj_sl_navigation .steam a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/steam-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .lastfm a {' + . 'ul#jj_sl_navigation .lastfm a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/lastfm-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .pinterest a {' + . 'ul#jj_sl_navigation .pinterest a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/pinterest-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .soundcloud a {' + . 'ul#jj_sl_navigation .soundcloud a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/soundcloud-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .tumblr a {' + . 'ul#jj_sl_navigation .tumblr a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/tumblr-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .github a {' + . 'ul#jj_sl_navigation .github a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/github-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .flickr a {' + . 'ul#jj_sl_navigation .flickr a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/flickr-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .rss a {' + . 'ul#jj_sl_navigation .rss a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/rss-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .vimeo a {' + . 'ul#jj_sl_navigation .vimeo a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/vimeo-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .custom1 a {' + . 'ul#jj_sl_navigation .custom1 a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom1_image') . ');' . '}' - .'ul#jj_sl_navigation .custom2 a {' + . 'ul#jj_sl_navigation .custom2 a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom2_image') . ');' . '}' - .'ul#jj_sl_navigation .custom3 a {' + . 'ul#jj_sl_navigation .custom3 a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom3_image') . ');' . '}' - .'ul#jj_sl_navigation .custom4 a {' + . 'ul#jj_sl_navigation .custom4 a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom4_image') . ');' . '}' - .'ul#jj_sl_navigation .custom5 a {' + . 'ul#jj_sl_navigation .custom5 a {' . 'background-position: 145px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom5_image') . ');' - . '}' - ; -} -else if ($params->get('position') == "right") { - if($params->get('jquery_css') == 0){ + . '}'; +} +elseif ($params->get('position') == "right") +{ + if ($params->get('jquery_css') == 0) + { $js_right = ' (function($){ $(function() { @@ -192,8 +209,10 @@ function () { $css = 'ul#jj_sl_navigation li {left: 140px;position: relative;}'; $document->addScriptDeclaration($js_right); } - if($params->get('jquery_css') == 1){ - $css= 'ul#jj_sl_navigation li { ' + + if ($params->get('jquery_css') == 1) + { + $css = 'ul#jj_sl_navigation li { ' . 'right: -138px;' . 'position:relative;' . '-webkit-transition: right 0.3s;' @@ -202,10 +221,11 @@ function () { . '-o-transition: right 0.3s;' . 'transition: right 0.3s;' . '}'; - $margin='-2px'; + $margin = '-2px'; } + $style = 'ul#jj_sl_navigation { ' - . $params->get('position') .':0px;' + . $params->get('position') . ':0px;' . 'top:' . $params->get('top') . 'px;' . '}' . 'ul#jj_sl_navigation li:hover { ' @@ -213,90 +233,90 @@ function () { . '}' . 'ul#jj_sl_navigation li a { ' . 'padding: 11px 10px 11px 0px;' - . 'margin-right:'.$margin.';' + . 'margin-right:' . $margin . ';' . '}' . 'ul#jj_sl_navigation .facebook a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/facebook-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .twitter a {' + . 'ul#jj_sl_navigation .twitter a {' . 'background-position: 5px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/twitter-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .google a {' + . 'ul#jj_sl_navigation .google a {' . 'background-position: 5px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/google-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .myspace a {' + . 'ul#jj_sl_navigation .myspace a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/myspace-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .youtube a {' + . 'ul#jj_sl_navigation .youtube a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/youtube-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .linkedin a {' + . 'ul#jj_sl_navigation .linkedin a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/linkedin-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .steam a {' + . 'ul#jj_sl_navigation .steam a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/steam-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .lastfm a {' + . 'ul#jj_sl_navigation .lastfm a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/lastfm-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .pinterest a {' + . 'ul#jj_sl_navigation .pinterest a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/pinterest-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .soundcloud a {' + . 'ul#jj_sl_navigation .soundcloud a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/soundcloud-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .tumblr a {' + . 'ul#jj_sl_navigation .tumblr a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/tumblr-' . $params->get('icon_colour') . '.png);' - . '}' - .'ul#jj_sl_navigation .github a {' + . '}' + . 'ul#jj_sl_navigation .github a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/github-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .flickr a {' + . 'ul#jj_sl_navigation .flickr a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/flickr-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .rss a {' + . 'ul#jj_sl_navigation .rss a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/rss-' . $params->get('icon_colour') . '.png);' . '}' - .'ul#jj_sl_navigation .vimeo a {' + . 'ul#jj_sl_navigation .vimeo a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/vimeo-' . $params->get('icon_colour') . '.png);' - . '}' - .'ul#jj_sl_navigation .custom1 a {' + . '}' + . 'ul#jj_sl_navigation .custom1 a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom1_image') . ');' . '}' - .'ul#jj_sl_navigation .custom2 a {' + . 'ul#jj_sl_navigation .custom2 a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom2_image') . ');' . '}' - .'ul#jj_sl_navigation .custom3 a {' + . 'ul#jj_sl_navigation .custom3 a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom3_image') . ');' . '}' - .'ul#jj_sl_navigation .custom4 a {' + . 'ul#jj_sl_navigation .custom4 a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom4_image') . ');' . '}' - .'ul#jj_sl_navigation .custom5 a {' + . 'ul#jj_sl_navigation .custom5 a {' . 'background-position: 4px 50%;' . 'background-image: url(' . JURI::root() . 'modules/mod_social_slider/assets/icons/' . $params->get('custom5_image') . ');' - . '}' - ; + . '}'; } + $custom_css = 'ul#jj_sl_navigation .custom1 a:hover{ background-color: ' . $params->get('custom1_colour') . '; } @@ -316,5 +336,4 @@ function () { $document->addStyleDeclaration($style); $document->addStyleDeclaration($css); -require(JModuleHelper::getLayoutPath('mod_social_slider')); -?> +require JModuleHelper::getLayoutPath('mod_social_slider'); diff --git a/mod_social_slider/mod_social_slider.xml b/mod_social_slider/mod_social_slider.xml index d1f1f2e..957493e 100644 --- a/mod_social_slider/mod_social_slider.xml +++ b/mod_social_slider/mod_social_slider.xml @@ -7,7 +7,7 @@ http://www.gnu.org/licenses/gpl-3.0.html admin@joomjunk.co.uk http://www.joomjunk.co.uk - 1.3.0 + 1.3.1 JJ_SOCIAL_SLIDER_DESC @@ -238,5 +238,4 @@ - diff --git a/mod_social_slider/tmpl/default.php b/mod_social_slider/tmpl/default.php index 644007a..03eb910 100644 --- a/mod_social_slider/tmpl/default.php +++ b/mod_social_slider/tmpl/default.php @@ -1,46 +1,50 @@ +* @copyright Copyright (C) 2011 - 2013 JoomJunk. All Rights Reserved +* @license GPL v3 http://www.gnu.org/licenses/gpl-3.0.html */ -// no direct access -defined( '_JEXEC' ) or die( 'Restricted access' ); +// No direct access +defined('_JEXEC') or die('Restricted access'); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root() . "modules/mod_social_slider/assets/style.css"); -if($params->get('tab', 0) == 0){ +if ($params->get('tab', 0) == 0) +{ $target = 'target="_blank"'; } -else { +else +{ $target = ""; } ?>