Filename | /home/vagrant/kohaclone/Koha/Template/Plugin/Koha.pm |
Statements | Executed 6 statements in 73µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 262µs | 380µs | BEGIN@20 | Koha::Template::Plugin::Koha::
9 | 3 | 3 | 100µs | 41.4ms | Preference | Koha::Template::Plugin::Koha::
1 | 1 | 1 | 29µs | 799µs | BEGIN@22 | Koha::Template::Plugin::Koha::
1 | 1 | 1 | 16µs | 19µs | BEGIN@24 | Koha::Template::Plugin::Koha::
1 | 1 | 1 | 6µs | 6µs | BEGIN@25 | Koha::Template::Plugin::Koha::
0 | 0 | 0 | 0s | 0s | Version | Koha::Template::Plugin::Koha::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Koha::Template::Plugin::Koha; | ||||
2 | |||||
3 | # Copyright ByWater Solutions 2013 | ||||
4 | |||||
5 | # This file is part of Koha. | ||||
6 | # | ||||
7 | # Koha is free software; you can redistribute it and/or modify it | ||||
8 | # under the terms of the GNU General Public License as published by | ||||
9 | # the Free Software Foundation; either version 3 of the License, or | ||||
10 | # (at your option) any later version. | ||||
11 | # | ||||
12 | # Koha is distributed in the hope that it will be useful, but | ||||
13 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | # GNU General Public License for more details. | ||||
16 | # | ||||
17 | # You should have received a copy of the GNU General Public License | ||||
18 | # along with Koha; if not, see <http://www.gnu.org/licenses>. | ||||
19 | |||||
20 | 2 | 499µs | # spent 380µs (262+118) within Koha::Template::Plugin::Koha::BEGIN@20 which was called:
# once (262µs+118µs) by Template::Plugins::_load at line 20 # spent 380µs making 1 call to Koha::Template::Plugin::Koha::BEGIN@20
# spent 118µs making 1 call to Modern::Perl::import | ||
21 | |||||
22 | 2 | 1.57ms | # spent 799µs (29+770) within Koha::Template::Plugin::Koha::BEGIN@22 which was called:
# once (29µs+770µs) by Template::Plugins::_load at line 22 # spent 799µs making 1 call to Koha::Template::Plugin::Koha::BEGIN@22
# spent 770µs making 1 call to base::import | ||
23 | |||||
24 | 2 | 22µs | # spent 19µs (16+3) within Koha::Template::Plugin::Koha::BEGIN@24 which was called:
# once (16µs+3µs) by Template::Plugins::_load at line 24 # spent 19µs making 1 call to Koha::Template::Plugin::Koha::BEGIN@24
# spent 3µs making 1 call to C4::Context::import | ||
25 | 1 | 6µs | # spent 6µs within Koha::Template::Plugin::Koha::BEGIN@25 which was called:
# once (6µs+0s) by Template::Plugins::_load at line 25 # spent 6µs making 1 call to Koha::Template::Plugin::Koha::BEGIN@25 | ||
26 | |||||
27 | =pod | ||||
28 | |||||
29 | This plugin contains various Koha replated Template Toolkit functions | ||||
30 | to help streamline Koha and to move logic from the Perl code into the | ||||
31 | Templates when it makes sense to do so. | ||||
32 | |||||
33 | To use, first, include the line '[% USE Koha %]' at the top | ||||
34 | of the template to enable the plugin. | ||||
35 | |||||
36 | For example: [% IF Koha.Preference( 'MyPreference ) == 'SettingA' %] | ||||
37 | removes the necessity of setting a template variable in Perl code for | ||||
38 | each and every system preference, even if no evaluation of the setting | ||||
39 | is necessary. | ||||
40 | |||||
41 | =cut | ||||
42 | |||||
43 | # spent 41.4ms (100µs+41.3) within Koha::Template::Plugin::Koha::Preference which was called 9 times, avg 4.60ms/call:
# 4 times (48µs+21.6ms) by Template::Stash::XS::get at line 87 of koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc, avg 5.40ms/call
# 4 times (41µs+16.8ms) by Template::Stash::XS::get at line 22 of koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc, avg 4.22ms/call
# once (11µs+2.91ms) by Template::Stash::XS::get at line 174 of koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt | ||||
44 | 3 | 2µs | my ( $self, $pref ) = @_; | ||
45 | 3 | 71µs | 9 | 41.3ms | return C4::Context->preference( $pref ); # spent 41.3ms making 9 calls to C4::Context::preference, avg 4.59ms/call |
46 | } | ||||
47 | |||||
48 | sub Version { | ||||
49 | my $version_string = Koha::version(); | ||||
50 | my ( $major, $minor, $maintenance, $development ) = split( '\.', $version_string ); | ||||
51 | |||||
52 | return { | ||||
53 | major => $major, | ||||
54 | release => $major . "." . $minor, | ||||
55 | maintenance => $major . "." . $minor . "." . $maintenance, | ||||
56 | development => ( $development ne '000' ) ? $development : undef, | ||||
57 | }; | ||||
58 | } | ||||
59 | |||||
60 | 1; |