From: <jon...@us...> - 2013-08-14 11:07:43
|
Revision: 47074 http://sourceforge.net/p/tikiwiki/code/47074 Author: jonnybradley Date: 2013-08-14 11:07:40 +0000 (Wed, 14 Aug 2013) Log Message: ----------- [bp/r47061[ENH] cookie consent: Set more useful defaults for params so it does something useful with no params set, and refactor html building so it's only needed once (thanks Geoff ;) Revision Links: -------------- http://sourceforge.net/p/tikiwiki/code/47061 Modified Paths: -------------- branches/11.x/lib/wiki-plugins/wikiplugin_cookieconsent.php branches/11.x/styles/layout/design.css Modified: branches/11.x/lib/wiki-plugins/wikiplugin_cookieconsent.php =================================================================== --- branches/11.x/lib/wiki-plugins/wikiplugin_cookieconsent.php 2013-08-14 10:29:22 UTC (rev 47073) +++ branches/11.x/lib/wiki-plugins/wikiplugin_cookieconsent.php 2013-08-14 11:07:40 UTC (rev 47074) @@ -26,8 +26,8 @@ 'element' => array( 'required' => false, 'name' => tra('Containing Element'), - 'description' => tra('DOM element to contain everything (DIV, SPAN etc). Default to empty for no container.'), - 'default' => '', + 'description' => tra('DOM element to contain everything (DIV, SPAN etc). Default to "div", set to "none" for no container.'), + 'default' => 'div', ), 'element_class' => array( 'required' => false, @@ -35,11 +35,11 @@ 'description' => tra('CSS class for above.'), 'default' => '', ), - 'consent_error_class' => array( + 'no_consent_class' => array( 'required' => false, - 'name' => tra('cookie no consent message CSS class'), - 'description' => tra('CSS class for no consent message.'), - 'default' => '', + 'name' => tra('No Consent CSS Class'), + 'description' => tra('CSS class for no consent message. Default "wp-cookie-consent-required"'), + 'default' => 'wp-cookie-consent-required', ), ) ); @@ -61,28 +61,20 @@ } $params = array_merge($defaults, $params); + $class = $params['element_class']; + if ($feature_no_cookie) { - $tag1 = $tag2 = ''; - if ($params['element']) { - if ($params['consent_error_class']) { - $tag1 = "<{$params['element']} class=\"{$params['consent_error_class']}\">"; - } else { - $tag1 = "<{$params['element']}>"; - } - $tag2 = "<{$params['element']}>"; - } $body = $params['no_consent_message']; - return $tag1 . $body . $tag2; + $class .= ($class ? ' ' : '') . $params['no_consent_class']; } $tag1 = $tag2 = ''; - if ($params['element']) { - if ($params['element_class']) { - $tag1 = "<{$params['element']} class=\"{$params['element_class']}\">"; - } else { - $tag1 = "<{$params['element']}>"; + if ($params['element'] && $params['element'] !== 'none') { + if ($class) { + $class = " class=\"{$class}\""; } - $tag2 = "<{$params['element']}>"; + $tag1 = "<{$params['element']}$class>"; + $tag2 = "</{$params['element']}>"; } return $tag1 . $body . $tag2; Modified: branches/11.x/styles/layout/design.css =================================================================== --- branches/11.x/styles/layout/design.css 2013-08-14 10:29:22 UTC (rev 47073) +++ branches/11.x/styles/layout/design.css 2013-08-14 11:07:40 UTC (rev 47074) @@ -3343,6 +3343,11 @@ -moz-border-radius: 2px; } + +.wp-cookie-consent-required { + color: #c00; +} + /* end plugins */ .magnify { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |