view release on metacpan or search on metacpan
lib/App/ZofCMS/Plugin/Barcode.pm
lib/App/ZofCMS/Plugin/Base.pm
lib/App/ZofCMS/Plugin/BasicLWP.pm
lib/App/ZofCMS/Plugin/BoolSettingsManager.pm
lib/App/ZofCMS/Plugin/BreadCrumbs.pm
lib/App/ZofCMS/Plugin/CRUD.pm
lib/App/ZofCMS/Plugin/CSSMinifier.pm
lib/App/ZofCMS/Plugin/Comments.pm
lib/App/ZofCMS/Plugin/ConditionalRedirect.pm
lib/App/ZofCMS/Plugin/ConfigToTemplate.pm
lib/App/ZofCMS/Plugin/Cookies.pm
lib/App/ZofCMS/Plugin/CurrentPageURI.pm
lib/App/ZofCMS/Plugin/DBI.pm
lib/App/ZofCMS/Plugin/DBIPPT.pm
lib/App/ZofCMS/Plugin/DataToExcel.pm
lib/App/ZofCMS/Plugin/DateSelector.pm
lib/App/ZofCMS/Plugin/Debug/Dumper.pm
lib/App/ZofCMS/Plugin/Debug/Validator/HTML.pm
lib/App/ZofCMS/Plugin/DirTreeBrowse.pm
lib/App/ZofCMS/Plugin/Doctypes.pm
lib/App/ZofCMS/Plugin/FeatureSuggestionBox.pm
version: '1.001008'
App::ZofCMS::Plugin::Comments:
file: lib/App/ZofCMS/Plugin/Comments.pm
version: '1.001008'
App::ZofCMS::Plugin::ConditionalRedirect:
file: lib/App/ZofCMS/Plugin/ConditionalRedirect.pm
version: '1.001008'
App::ZofCMS::Plugin::ConfigToTemplate:
file: lib/App/ZofCMS/Plugin/ConfigToTemplate.pm
version: '1.001008'
App::ZofCMS::Plugin::Cookies:
file: lib/App/ZofCMS/Plugin/Cookies.pm
version: '1.001008'
App::ZofCMS::Plugin::CurrentPageURI:
file: lib/App/ZofCMS/Plugin/CurrentPageURI.pm
version: '1.001008'
App::ZofCMS::Plugin::DBI:
file: lib/App/ZofCMS/Plugin/DBI.pm
version: '1.001008'
App::ZofCMS::Plugin::DBIPPT:
file: lib/App/ZofCMS/Plugin/DBIPPT.pm
version: '1.001008'
examples/test_example.pl view on Meta::CPAN
# VERSION
use Test::More;
eval "use App::ZofCMS::Test::Plugin;";
plan skip_all
=> "App::ZofCMS::Test::Plugin required for testing plugin"
if $@;
plugin_ok(
'Cookies',
{ set_cookies => [ [foo => 'bar'] ], },
{ foo => 'bar' },
{ foo => 'bar' },
);
lib/App/ZofCMS/Plugin/Cookies.pm view on Meta::CPAN
package App::ZofCMS::Plugin::Cookies;
use warnings;
use strict;
our $VERSION = '1.001008'; # VERSION
sub new { return bless {}, shift }
sub process {
my ( $self, $template, $query, $config ) = @_;
lib/App/ZofCMS/Plugin/Cookies.pm view on Meta::CPAN
$cookies = [ $cookies ];
}
for ( @$cookies ) {
my $cookie;
if ( ref eq 'HASH' ) {
$cookie = $cgi->cookie( %$_ );
}
else {
$cookie = $cgi->cookie( -name => $_->[0], -value => $_->[1] );
}
print "Set-Cookie: $cookie\n";
}
}
return;
}
1;
__END__
=encoding utf8
=head1 NAME
App::ZofCMS::Plugin::Cookies - HTTP Cookie handling plugin for ZofCMS
=head1 SYNOPSIS
In your ZofCMS template, or in your main config file (under C<template_defaults>
or C<dir_defaults>):
set_cookies => [
[ 'name', 'value' ],
{
-name => 'sessionID',
lib/App/ZofCMS/Plugin/Cookies.pm view on Meta::CPAN
If C<set_cookies> key is not present, no cookies will be set.
=head1 READING COOKIES
All of the cookies are read by the plugin automatically and put into
C<< {d}{cookies} >> (the special key C<{d}> (data) of your ZofCMS template)
You can read those either via C<exec> code (NOT C<exec_before>, plugins
are run after) (If you don't know what C<exec> or C<exec_before> are
read L<App::ZofCMS::Template>). Other plugins can also read those cookies,
just make sure they are run I<after> the Cookies plugin is run (set
higher priority number). Below is an example of reading a cookie and
displaying it's value in your L<HTML::Template> template using
L<App::ZofCMS::Plugin::Tagged> plugin.
# In your ZofCMS template:
plugins => [ { Cookies => 10 }, { Tagged => 20 }, ],
set_cookies => [ foo => 'bar' ],
t => {
cookie_foo => '<TAG:TNo cookies:{d}{cookies}{foo}>',
},
# In one of your HTML::Template templates which are referenced by
# ZofCMS plugin above:
Cookie 'foo': <tmpl_var name="cookie_foo">
When this page is run the first time, no cookies are set, thus
{d}{cookies} will be empty and you will see the default value of
"No cookies" which we set in Tagged's tag:
Cookie 'foo': No cookies
When the page s run the second time, Cookies plugin will read cookie
'foo' which it set on the first run and will stick its value
into {d}{cookies}{foo}. Our Tagged tag will read that value and enter
it into the C<< <tmpl_var> >> we allocated in L<HTML::Template> plugin,
thus the result will be:
Cookie 'foo': bar
That's all there is to it, enjoy!
=head1 REPOSITORY
Fork this module on GitHub:
L<https://github.com/zoffixznet/App-ZofCMS>
=head1 BUGS
lib/App/ZofCMS/Plugin/Session.pm view on Meta::CPAN
}
else {
$session_id = rand() . time() . rand();
$session_id =~ tr/.//d;
my $cookie = $config->cgi->cookie(
-name => $conf{cookie_name},
-path => '/',
-value => $session_id,
-expires => $conf{cookie_expiry},
);
print "Set-Cookie: $cookie\n";
$dbh->do(
"INSERT INTO $conf{table} VALUES( ?, ?, ? );",
undef,
$session_id,
time(),
freeze( $template->{ $conf{cell} }{ $conf{key} } ),
);
}
lib/App/ZofCMS/Plugin/StyleSwitcher.pm view on Meta::CPAN
my $tp = $conf->{t_prefix};
$template->{t}{ $tp . 'style' } = $self->_make_style_html( $conf, $style );
$template->{t}{ $tp . 'toggle' } = $self->_make_toggle_html(
$conf,
map +(defined() ? $_ : ''), @$query{qw/page dir/},
$style,
);
$dbh->disconnect;
print "Set-Cookie: plug_style_switcher=$style\n";
if ( $query->{ $conf->{q_ajax_name} } ) {
print "Content-type: text/plain\n\n";
exit;
}
}
sub _make_toggle_html {
my ( $self, $conf, $page, $dir, $style ) = @_;
my $styles_ref = $conf->{styles};
lib/App/ZofCMS/Plugin/Tagged.pm view on Meta::CPAN
App::ZofCMS::Plugin::Tagged - ZofCMS plugin to fill templates with data from query, template variables and configuration using <TAGS>
=head1 SYNOPSIS
Your ZofCMS template:
{
cookie_foo => '<TAG:TNo cookies:{d}{cookies}{foo}>',
query_foo => '[<TAG:Q:{foo}>]',
set_cookies => [ ['foo', 'bar' ]],
plugins => [ { Cookies => 10 }, { Tagged => 20 } ],
conf => {
base => 'test.tmpl',
},
}
In your 'test.tmpl' base L<HTML::Template> template:
Cookie 'foo' is set to: <tmpl_var name="cookie_foo"><br>
Query 'foo' is set to: <tmpl_var name="query_foo">
In ZofCMS template the Cookies plugin is set to run before Tagged plugin,
thus on first page access cookies will not be set, and we will access
the page without setting the 'foo' query parameter. What do we see:
Cookie 'foo' is set to: No cookies
Query 'foo' is set to: []
No, if we run the page the second time it (now cookies are set with
L<App::ZofCMS::Plugin::Cookies> plugin) will look like this:
Cookie 'foo' is set to: bar
Query 'foo' is set to: []
If we pass query parameter 'foo' to the page, setting it to 'beer'
our page will look like this:
Cookie 'foo' is set to: bar
Query 'foo' is set to: [beer]
That's the power of Tagged plugin... now I'll explain what those weird
looking tags mean.
=head1 DESCRIPTION
The module provides means to the user to use special "tags" in B<scalar>
values inside ZofCMS template. This provides the ability to display
data generated by templates (i.e. stored in C<{d}> first level key), access
query or configuration hashref. Possibilities are endless.
B<This documentation assumes you have read documentation for>
L<App::ZofCMS> B<including> L<App::ZofCMS::Config> B<and>
L<App::ZofCMS::Template>
=head1 STARTING WITH THE PRIORITY
First of all, when using App::ZofCMS::Plugin::Tagged with other plugins
make sure to set the correct priority. In our example above, we used
L<App::ZofCMS::Plugin::Cookies> which reads currently set cookies into
C<{d}> special key in ZofCMS template. That's why we set priority of C<10>
to Cookies plugin and priority of C<20> to Tagged plugin - to insure
Tagged runs after C<{d}{cookies}> have been filled in.
B<Note:> currently there is no support to run Tagged plugin twice,
I'm not sure that will ever be needed, but if you do come across such
situation, you can easily cheat. Just copy Tagged.pm in your
C<$core/App/ZofCMS/Plugin/Tagged.pm> to Tagged2.pm (and ajust the name
accordingly in the C<package> line inside the file). Now you have two
Tagged plugins, and you can do stuff like
C<< plugins => [ {Tagged => 10}, { SomePlugin => 20 }, { Tagged2 => 30 } ] >>
lib/App/ZofCMS/Plugin/UserLogin.pm view on Meta::CPAN
smart_deny_name => $opts->{smart_deny},
smart_deny_value => $query->{ $opts->{smart_deny} },
);
return;
}
if ( $opts->{no_cookies} ) {
$template->{t}{plug_login_session_id} = $session_id;
}
else {
print "Set-Cookie: $opts->{preserve_login}=$query->{login}; path=/; expires=Sat, 23 May 2037 23:38:25 GMT\n"
if $opts->{preserve_login};
print "Set-Cookie: zofcms_plug_login_s=$session_id; path=/;\n";
printf "Set-Cookie: zofcms_plug_login_l=%s; path=/;\n",
md5_hex($query->{login});
}
if ( $opts->{redirect_on_login} ) {
print $config->cgi->redirect(
process_smart_deny_logon( $opts, $query )
);
exit;
}
else {
t/00-compile.t view on Meta::CPAN
'App/ZofCMS/Plugin/Barcode.pm',
'App/ZofCMS/Plugin/Base.pm',
'App/ZofCMS/Plugin/BasicLWP.pm',
'App/ZofCMS/Plugin/BoolSettingsManager.pm',
'App/ZofCMS/Plugin/BreadCrumbs.pm',
'App/ZofCMS/Plugin/CRUD.pm',
'App/ZofCMS/Plugin/CSSMinifier.pm',
'App/ZofCMS/Plugin/Comments.pm',
'App/ZofCMS/Plugin/ConditionalRedirect.pm',
'App/ZofCMS/Plugin/ConfigToTemplate.pm',
'App/ZofCMS/Plugin/Cookies.pm',
'App/ZofCMS/Plugin/CurrentPageURI.pm',
'App/ZofCMS/Plugin/DBI.pm',
'App/ZofCMS/Plugin/DBIPPT.pm',
'App/ZofCMS/Plugin/DataToExcel.pm',
'App/ZofCMS/Plugin/DateSelector.pm',
'App/ZofCMS/Plugin/Debug/Dumper.pm',
'App/ZofCMS/Plugin/Debug/Validator/HTML.pm',
'App/ZofCMS/Plugin/DirTreeBrowse.pm',
'App/ZofCMS/Plugin/Doctypes.pm',
'App/ZofCMS/Plugin/FeatureSuggestionBox.pm',
xt/author/eol.t view on Meta::CPAN
'lib/App/ZofCMS/Plugin/Barcode.pm',
'lib/App/ZofCMS/Plugin/Base.pm',
'lib/App/ZofCMS/Plugin/BasicLWP.pm',
'lib/App/ZofCMS/Plugin/BoolSettingsManager.pm',
'lib/App/ZofCMS/Plugin/BreadCrumbs.pm',
'lib/App/ZofCMS/Plugin/CRUD.pm',
'lib/App/ZofCMS/Plugin/CSSMinifier.pm',
'lib/App/ZofCMS/Plugin/Comments.pm',
'lib/App/ZofCMS/Plugin/ConditionalRedirect.pm',
'lib/App/ZofCMS/Plugin/ConfigToTemplate.pm',
'lib/App/ZofCMS/Plugin/Cookies.pm',
'lib/App/ZofCMS/Plugin/CurrentPageURI.pm',
'lib/App/ZofCMS/Plugin/DBI.pm',
'lib/App/ZofCMS/Plugin/DBIPPT.pm',
'lib/App/ZofCMS/Plugin/DataToExcel.pm',
'lib/App/ZofCMS/Plugin/DateSelector.pm',
'lib/App/ZofCMS/Plugin/Debug/Dumper.pm',
'lib/App/ZofCMS/Plugin/Debug/Validator/HTML.pm',
'lib/App/ZofCMS/Plugin/DirTreeBrowse.pm',
'lib/App/ZofCMS/Plugin/Doctypes.pm',
'lib/App/ZofCMS/Plugin/FeatureSuggestionBox.pm',
xt/author/no-tabs.t view on Meta::CPAN
'lib/App/ZofCMS/Plugin/Barcode.pm',
'lib/App/ZofCMS/Plugin/Base.pm',
'lib/App/ZofCMS/Plugin/BasicLWP.pm',
'lib/App/ZofCMS/Plugin/BoolSettingsManager.pm',
'lib/App/ZofCMS/Plugin/BreadCrumbs.pm',
'lib/App/ZofCMS/Plugin/CRUD.pm',
'lib/App/ZofCMS/Plugin/CSSMinifier.pm',
'lib/App/ZofCMS/Plugin/Comments.pm',
'lib/App/ZofCMS/Plugin/ConditionalRedirect.pm',
'lib/App/ZofCMS/Plugin/ConfigToTemplate.pm',
'lib/App/ZofCMS/Plugin/Cookies.pm',
'lib/App/ZofCMS/Plugin/CurrentPageURI.pm',
'lib/App/ZofCMS/Plugin/DBI.pm',
'lib/App/ZofCMS/Plugin/DBIPPT.pm',
'lib/App/ZofCMS/Plugin/DataToExcel.pm',
'lib/App/ZofCMS/Plugin/DateSelector.pm',
'lib/App/ZofCMS/Plugin/Debug/Dumper.pm',
'lib/App/ZofCMS/Plugin/Debug/Validator/HTML.pm',
'lib/App/ZofCMS/Plugin/DirTreeBrowse.pm',
'lib/App/ZofCMS/Plugin/Doctypes.pm',
'lib/App/ZofCMS/Plugin/FeatureSuggestionBox.pm',