Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Added Help
Browse files Browse the repository at this point in the history
Compresses resources
  • Loading branch information
Moqume committed May 4, 2012
1 parent 6941d57 commit d00d51c
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 22 deletions.
5 changes: 4 additions & 1 deletion app/Myatu/WordPress/Cookillian/Main.php
Expand Up @@ -11,6 +11,7 @@

use Pf4wp\Common\Cookies;
use Pf4wp\Common\Helpers;
use Pf4wp\Help\ContextHelp;
use Pf4wp\Notification\AdminNotice;

class Main extends \Pf4wp\WordpressPlugin
Expand All @@ -28,6 +29,7 @@ class Main extends \Pf4wp\WordpressPlugin
// Flag to indicate (to JS) whether cookies are blocked
protected $cookies_blocked;

// Default options
protected $default_options = array(
'geo_service' => 'geoplugin',
'cookie_groups' => array('Unknown'),
Expand Down Expand Up @@ -609,11 +611,12 @@ public function onBuildMenu()

// Add settings menu
$main_menu = $mymenu->addMenu(__('Cookies'), array($this, 'onSettingsMenu'));
//$main_menu->context_help = new ContextHelp($this, 'settings');
$main_menu->context_help = new ContextHelp($this, 'settings');

// Add cookies menu
$cookie_menu = $mymenu->addSubmenu(__('Cookies', $this->getName()), array($this, 'onCookiesMenu'));
$cookie_menu->count = count($this->options->known_cookies);
$cookie_menu->context_help = new ContextHelp($this, 'cookies');

return $mymenu;
}
Expand Down
7 changes: 7 additions & 0 deletions resources/css/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion resources/css/admin.dev.css
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2011-2012 Mike Green <myatus@gmail.com>
* Copyright (c) 2012 Mike Green <myatus@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
7 changes: 7 additions & 0 deletions resources/css/pub.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions resources/help/cookies.ini
@@ -0,0 +1,22 @@
; Copyright (c) 2012 Mike Green <myatus@gmail.com>
;
;For the full copyright and license information, please view the LICENSE
;file that was distributed with this source code.

[overview]
content = "<p>This screen shows a list of known cookies and their descriptions.<p>
<p>Cookie names can contain wildcards to match multiple variations of the same cookie. The questionmark (<code>?</code>) wildcard matches a single character only, whereas an asterisk (<code>*</code>) can match one or more characters. The wildcards can be located anywhere within the cookie name. For example, <code>wp-settings-*</code> will match any cookie starting with \"wp-settings-\" such as \"wp-settings-1\" or \"wp-settings-229\"; <code>wp-site?-info</code> will match \"wp-site1-info\" and \"wp-siteA-info\", but not \"wp-site-details-info\".</p>
<p>If a cookie is marked as <em>Required</em>, then Cookillian will not filter the cookie and a listing will display that this cookie is required for the operation of the website.<p>
<p>A listing can be generated using the <code>[cookillian cookies]</code> shortcode, which will display all the cookies listed on this page. To list only certain cookies within a group, add this to the shortcode as <code>[cookillian cookies=\"group name\"]</code> where <em>group name</em> matches the <em>Group</em> listed on this page.</p>
<p>To delete one or more cookies from the listing, tick/select the box in the <em>Delete</em> column and they will be removed when the changes are saved.</p>"

[side_tab]
content = "<p><strong>For more information:</strong></p>
<p><a target=\"_blank\" href=\"#\">Background Manager Home Page</a></p>

<p><a target=\"_blank\" href=\"http://wordpress.org/tags/cookillian\">Support Forum</a></p>"
45 changes: 45 additions & 0 deletions resources/help/settings.ini
@@ -0,0 +1,45 @@
; Copyright (c) 2012 Mike Green <myatus@gmail.com>
;
;For the full copyright and license information, please view the LICENSE
;file that was distributed with this source code.

[overview]
content = "<p>This screen provides access to the Cookillian settings, where you can customize how the Cookillian filters cookies and appears on your website.</p>
<p>Cookillian can automatically add new or unknown cookies to the <strong>Cookies</strong> list, which helps you identify cookies being used throughout the website. The <strong>Cookies</strong> list can also be retrieved using the <code>[cookillian cookies]</code> shortcode, or filtered by a specific group using <code>[cookillian cookies=\"group name\"]</code>. This eases the task of providing the visitor with details about the cookies used throughout the website.</p>
<p>PHP sessions based on cookies are filtered unless they are required. Many plugins will use WordPress' own session handling methods, however, if the website is tightly integrated with other web applications then you may need to disable the filtering.</p>
<p>To increase the user experience of your website, only visitors from selected countries will have their cookies filtered and be alerted about the use of cookies. Cookillian can use geoPlugin service to determine where the visitor originates. If you are a CloudFlare subscriber, you may wish to use CloudFlare's own geolocation service to benefit of a significant speed increase.</p>
<p>An alert can be displayed automatically, or you can insert the HTML code for the alert manually by editing your theme and inserting <code>&lt;?php echo apply_filters('cookillian_alert', ''); ?&gt;</code> at the desired location. Alternatively, you can use the <code>[cookillian alert]</code> shortcode within a post, page or other WordPress element that supports shortcodes. The default alert content text can be altered to suit your website's needs, or alternatively you can provide your own HTML code for full customization.</p>
<p>If the visitor has permitted the use of cookies, additional JavaScript can be loaded at the header and/or footer using the two provided fields. As an example, this could be used to load analytics scripts that make use of cookies to track the visitor. For more complex use of JavaScript, select the <strong>JavaScript</strong> help tab.</p>"

[javascript]
title = "JavaScript"
content = "<p>Cookillian provides a simple way to add JavaScript when cookies are permitted. However, if your circumstances require more complex use of JavaScript, Cookillian also exposes several JavaScript variables that can be used:</p>
<ul>
<li><code>cookillian.blocked_cookies</code> - A boolean statement that is set to <code>true</code> if cookies are blocked / not permitted, or <code>false</code> if cookies are accepted / permitted.</li>
<li><code>cookillian.opted_out</code> - A boolean statement, which is set to <code>true</code> if the user has specifically opted <em>out</em> of cookies (and thus <code>cookillian.blocked_cookies</code> will also be <code>true</code>).</li>
<li><code>cookillian.opted_in</code> - A boolean statement, which is set to <code>true</code> if the user has specifically opted <em>in</em> of cookies (and thus <code>cookillian.blocked_cookies</code> will be <code>false</code>).</li>
</ul>"

[html]
title = "Custom Alert"
content = "<p>When creating a custom alert, you can provide the visitor the option to permanently opt in to receive cookies, or opt out. To do so, simply direct the visitor to any page adding to the URI <code>?cookillian_resp=1</code> to opt in or <code>?cookillian_resp=0</code> to opt out. This could be done with a link as simple as <code>&lt;a href=\"\?cookillian_resp=1\"&gt;Opt In&lt;/a&gt;</code>.</p>
<p>Once the opt in/out preference has been saved in the cookies <code>cookillian_opt_in</code> or <code>cookillian_opt_out</code> respectively, the visitor will be returned to the original page from which the request was made.</p>"

[side_tab]
content = "<p><strong>For more information:</strong></p>
<p><a target=\"_blank\" href=\"#\">Background Manager Home Page</a></p>

<p><a target=\"_blank\" href=\"http://wordpress.org/tags/cookillian\">Support Forum</a></p>

<p><a target=\"_blank\" href=\"http://www.geoplugin.net\">GeoPlugin</a></p>

<p><a target=\"_blank\" href=\"http://www.cloudflare.com\">CloudFlare</a></p>"
2 changes: 1 addition & 1 deletion resources/js/admin.dev.js
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2011-2012 Mike Green <myatus@gmail.com>
* Copyright (c) 2012 Mike Green <myatus@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
8 changes: 8 additions & 0 deletions resources/js/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions resources/js/pub.dev.js
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2011-2012 Mike Green <myatus@gmail.com>
* Copyright (c) 2012 Mike Green <myatus@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,7 +13,7 @@ if (cookillian === undefined)
$(document).ready(function($){
var cookillian_alert = $('.cookillian-alert');

// Move it to the top, moving existing content down
// Move it to the top, forcing existing content down
if (!cookillian._manual)
cookillian_alert.hide().detach().prependTo('body').fadeIn('slow');

Expand Down
8 changes: 8 additions & 0 deletions resources/js/pub.js
@@ -0,0 +1,8 @@
/*!
* Copyright (c) 2012 Mike Green <myatus@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
if(cookillian===undefined){var cookillian={}}(function(b){b(document).ready(function(a){var d=a(".cookillian-alert");if(!cookillian._manual){d.hide().detach().prependTo("body").fadeIn("slow")}a(".close",d).click(function(){d.fadeOut("slow");return false})})})(jQuery);
3 changes: 3 additions & 0 deletions resources/views/ask.html.twig
Expand Up @@ -4,6 +4,7 @@
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% spaceless %}

<div class="cookillian-alert">
<a class="close">×</a>
Expand All @@ -18,3 +19,5 @@
{% if not manual %}
<noscript><style type="text/css" media="screen">.cookillian-alert { position: absolute; left: 0; top: 0; } .cookillian-alert .close { display: none; }</style></noscript>
{% endif %}

{% endspaceless %}
22 changes: 8 additions & 14 deletions resources/views/cookie_table.html.twig
Expand Up @@ -4,33 +4,25 @@
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% spaceless %}

{% set last_head = '' %}
<table>
<thead>
<th scope="col">{{ __('Name') }}</th>
<th scope="col">{{ __('Description') }}</th>
</thead>
<table class="cookillian_table">
<tbody>
{% for cookie_name, cookie_value in cookies %}

{% if last_head != cookie_value.group %}
{% set last_head = cookie_value.group %}
<tr>
<td colspan="2">
<h2>{{ cookie_value.group }}</h2>
</td>
<th scope="row" colspan="2">{{ cookie_value.group }}
</th>
</tr>

{% endif %}
<tr>
<td>{{ cookie_name }}</td>
<td>
{{ cookie_name }}
</td>
<td>
<p>
{{ cookie_value.desc }}
</p>
<p>{{ cookie_value.desc }}</p>

{% if cookie_value.required %}
<p>
Expand All @@ -42,3 +34,5 @@
{% endfor %}
</tbody>
</table>

{% endspaceless %}
4 changes: 1 addition & 3 deletions resources/views/settings.html.twig
Expand Up @@ -83,8 +83,6 @@
{{ __('Show Alert') }}
</th>
<td>
<p>{{ __('An alert about cookies will be shown to visitors from the countries selected above, provided they have neither opted in nor out.') }}</p>
<p>{{ __('When set to <em>Manually</em>, the alert can be rendered inside a theme using the code: <code>&lt;?php echo apply_filters(\'cookillian_alert\', \'\'); ?&gt;</code> or using shortcode <code>[cookillian alert]</code>.') | raw }}</p>
<label>
<input type="radio" name="alert_show" value="auto" {% if alert_show == 'auto' %}checked="checked"{% endif %} />
{{ __('Automatic') }}
Expand Down Expand Up @@ -203,7 +201,7 @@
<tr>
<th></th>
<td>
<p>{{ __('The following JavaScript will be loaded in the page header and/or footer when cookies are permitted. For example, this could be used to load Google Analytics. See <strong>Help</strong> for more information.') | raw }}</p>
<p>{{ __('The following JavaScript will <em>only</em> be loaded in the page header and/or footer when cookies are permitted. For example, this could be used to load Google Analytics. See <strong>Help</strong> for complex JavaScript use.') | raw }}</p>
</td>
</tr>
<tr>
Expand Down

0 comments on commit d00d51c

Please sign in to comment.