view release on metacpan or search on metacpan
lib/App/ZofCMS/Plugin/DBIPPT.pm view on Meta::CPAN
I only required doing such post-processing as this plugin when I used
the DBI plugin.
=head1 WTF IS PPT?
Ok, the name C<DBIPPT> isn't the most clear choice for the name of
the plugin, but when I first wrote out the full name I realized that
the name alone defeats the purpose of the plugin - saving keystrokes -
so I shortened it from C<DBIPostProcessLargeText> to C<DBIPPT> (the C<L>
was lost in "translation" as well). If you're suffering from memory
problems, I guess one way to remember the name is "B<P>lease B<Process>
B<This>".
=head1 FIRST-LEVEL ZofCMS TEMPLATE AND MAIN CONFIG FILE KEYS
=head2 C<plugins>
plugins => [
{ DBI => 2000 }, # example plugin that generates original data
{ DBIPPT => 3000 }, # higher run level (priority)
],
lib/App/ZofCMS/Plugin/LinkifyText.pm view on Meta::CPAN
{ ex => 'foo', ex2 => 'bar' },
{ ex => 'ber', ex2 => 'beer' },
{ ex => 'baz', ex2 => 'craz' },
],
dbi_output_single => 'some random text',
If you want to linkify all the texts inside C<dbi_output>
to which the C<ex> keys point, you'd set C<text> value as
C<< text => \[ qw/dbi_output ex/ ] >>. If you want to linkify the C<ex2>
data as well, then you'd set C<text> as
C<< text => \[ qw/dbi_output ex ex2/ ] >>. Can you guess what the code
to linkify I<all> the text in the example above will be? Here it is:
# note that we are assigning a REF of an arrayref to the first `text`
plug_linkify_text => {
text => \[
'dbi_output', # the key inside {t}
'ex', 'ex2' # keys of individual hashrefs that point to data
],
text2 => 'dbi_output_single', # note that we didn't have to make this a ref
}
lib/App/ZofCMS/Plugin/SendFile.pm view on Meta::CPAN
=head1 SYNOPSIS
In your ZofCMS Template or Main Config File:
plugins => [ qw/SendFile/ ],
plug_send_file => [
'../zcms_site/config.txt', # filename to send; this one is outside the webdir
'attachment', # optional to set content-disposition to attachment
'text/plain', # optional to set content-type instead of guessing one
'LOL.txt', # optional to set filename instead of using same as original
],
In your HTML::Template template:
<tmpl_if name='plug_send_file_error'>
<p class="error">Got error: <tmpl_var escape='html' name='plug_send_file_error'></p>
</tmpl_if>
=head1 DESCRIPTION
lib/App/ZofCMS/Plugin/SendFile.pm view on Meta::CPAN
B<NOTE:> unless an error occurs, the plugins calls C<exit()> when it's done sending the file,
make sure that all the required plugins had their chance to execute BEFORE this one.
=head2 C<plug_send_file>
plug_send_file => 'foo.txt', # file to send
plug_send_file => [
'../zcms_site/config.txt', # filename to send; this one is outside the webdir
'attachment', # optional to set content-disposition to attachment
'text/plain', # optional to set content-type instead of guessing one
'LOL.txt', # optional to set filename instead of using same as original
],
plug_send_file => sub {
my ( $t, $q, $conf ) = @_;
return 'foo.txt';
},
B<Mandatory>. Takes either a string, subref or an arrayref as a value, can be specified in
either ZofCMS Template or Main Config File; if set in both, the value in ZofCMS Template is
lib/App/ZofCMS/Plugin/SendFile.pm view on Meta::CPAN
=head3 THIRD ELEMENT
plug_send_file => [
'../zcms_site/config.txt',
undef,
'text/plain',
]
B<Optional>. Specifies the C<Content-Type> to use. When set to C<undef>, the plugin will
try to guess the correct type to use using C<MIME::Types> module.
B<Defauts to:> C<undef>
=head3 FOURTH ELEMENT
plug_send_file => [
'../zcms_site/config.txt',
undef,
undef,
'LOL.txt',
],
lib/App/ZofCMS/Plugin/UserLogin/ForgotPassword.pm view on Meta::CPAN
code_expiry => 24*60*60, # 1 day
code_length => 6,
use_stage_indicators => 1,
subject => 'Password Reset',
login_page => '/',
button_send_link => q|<input type="submit" class="input_submit"|
. q| value="Send password">|,
button_change_pass => q|<input type="submit" class="input_submit"|
. q| value="Change password">|,
# email_link => undef, # this will be guessed
# from => undef,
# email_template => undef, # use plugin's default template
# no_run => undef
# create_table => undef,
# mime_lite_params => undef,
# email => undef,
);
}
sub _do {
lib/App/ZofCMS/Plugin/UserLogin/ForgotPassword.pm view on Meta::CPAN
pass => undef,
opt => { RaiseError => 1, AutoCommit => 1 },
users_table => 'users',
code_table => 'users_forgot_password',
q_code => 'pulfp_code',
max_abuse => '5:10:60', # 5 min. intervals, max 10 attempts per 60 min.
min_pass => 6,
code_expiry => 24*60*60, # 1 day
code_length => 6,
subject => 'Password Reset',
email_link => undef, # this will be guessed
from => undef,
email_template => undef, # use plugin's default template
create_table => undef,
login_page => '/',
mime_lite_params => undef,
email => undef, # use `email` column in users table
button_send_link => q|<input type="submit" class="input_submit"|
. q| value="Send password">|,
button_change_pass => q|<input type="submit" class="input_submit"|
. q| value="Change password">|,
lib/App/ZofCMS/Plugin/UserLogin/ForgotPassword.pm view on Meta::CPAN
pass => undef,
opt => { RaiseError => 1, AutoCommit => 1 },
users_table => 'users',
code_table => 'users_forgot_password',
q_code => 'pulfp_code',
max_abuse => '5:10:60', # 5 min. intervals, max 10 attempts per 60 min.
min_pass => 6,
code_expiry => 24*60*60, # 1 day
code_length => 6,
subject => 'Password Reset',
email_link => undef, # this will be guessed
from => undef,
email_template => undef, # use plugin's default template
create_table => undef,
login_page => '/',
mime_lite_params => undef,
email => undef, # use `email` column in users table
button_send_link => q|<input type="submit" class="input_submit"|
. q| value="Send password">|,
button_change_pass => q|<input type="submit" class="input_submit"|
. q| value="Change password">|,
lib/App/ZofCMS/Plugin/UserLogin/ForgotPassword.pm view on Meta::CPAN
=head3 C<code_length>
plug_user_login_forgot_password => {
code_length => 6,
...
B<Optional>. Specifies the length of the randomly generated code that
is used to identify legitimate user. Since this code is sent to the
user via email, and is directly visible, specifying the code to be
of too much length will look rather ugly. On the other hand, too short
of a code can be easily guessed by a vandal.
B<Defaults to:> C<6>
=head3 C<subject>
plug_user_login_forgot_password => {
subject => 'Password Reset',
...
B<Optional>. Takes a string as a value, this will be used as the subject
line of the email sent to the user (the one containing the link to click).
lib/App/ZofCMS/Plugin/UserLogin/ForgotPassword.pm view on Meta::CPAN
B<Optional>. Takes a scalar as a value that specifies the C<From> field for
your email. If not specified, the plugin will simply not set the C<From>
argument in L<MIME::Lite>'s C<new()> method (which is what this plugin uses
under the hood). See L<MIME::Lite>'s docs for more description.
B<Defaults to:> C<undef> (not specified)
=head3 C<email_link>
plug_user_login_forgot_password => {
email_link => undef, # guess the right page
...
# note how the URI ends with the "invitation" to append the reset
# ... code right to the end
plug_user_login_forgot_password => {
email_link => 'http://foobar.com/your_page?foo=bar&pulfp_code=',
...
B<Optional>. Takes either C<undef> or a string containing a link
as a value. Specifies the link to the page with this plugin enabled, this
link will be emailed to the user so that they could proceed to
enter their new password. When set to C<undef>, the plugin guesses the
current page (using C<%ENV>) and that's what it will use for the link.
If you specify the string, make sure to end it with C<pulfp_code=> (note
the equals sign at the end), where C<pulfp_code> is the value you have set
for C<q_code> argument. B<Defaults to:> C<undef> (makes the plugin guess
the right link)
=head3 C<email_template>
plug_user_login_forgot_password => {
email_template => undef, # use plugin's default template
...
plug_user_login_forgot_password => {
email_template => \'templates/file.tmpl', # read template from file