This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601(list_to_binary(Time)); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| parse_date(Time,{},parse_year). | |
| parse_date(<<Year:32/bitstring, Rest/bitstring>>, Acc, parse_year) -> | |
| parse_date(Rest, {Acc, Year}, parse_month); | |
| parse_date(<<"-", Rest/bitstring>>, Acc, State) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| вот так | |
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601(list_to_binary(Time)); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| parse_date(Time,{},parse_year). | |
| parse_date(<<Year:32/bitstring, Rest/bitstring>>, Acc, parse_year) -> | |
| parse_date(Rest, {Acc, Year}, parse_month); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601(list_to_binary(Time)); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| parse_date(Time,{},parse_year). | |
| parse_date(<<"-", Rest/bitstring>>, Acc, parse_second) -> | |
| parse_date(Rest, Acc, parse_tz_hour); | |
| parse_date(<<"-", Rest/bitstring>>, Acc, parse_fraction) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601(list_to_binary(Time)); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| parse_date(Time,{},parse_year). | |
| parse_date(<<"-", Rest/bitstring>>, Acc, parse_second) -> | |
| parse_date(Rest, Acc, parse_tz_hour); | |
| parse_date(<<"-", Rest/bitstring>>, Acc, parse_fraction) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -record(timestamp, {year, month, day, hour, minute, second, fraction, timezone}). | |
| -record(timezone, {hour, minute}). | |
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601( list_to_binary(Time) ); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| try | |
| {ok, iso_to_rec( | |
| year, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parse_iso8601(Time) when is_list(Time) -> | |
| parse_iso8601( list_to_binary(Time) ); | |
| parse_iso8601(Time) when is_binary(Time) -> | |
| try | |
| {ok, iso_to_rec( | |
| year, | |
| Time, | |
| #timestamp{ | |
| year = 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| to_tz(R, Tz) -> | |
| Tz_offset = ((Tz#timezone.hour * 60) + Tz#timezone.minute) * 60, | |
| R_offset = (((R#timestamp.timezone)#timezone.hour * 60) + (R#timestamp.timezone)#timezone.minute) * 60, | |
| R_seconds = calendar:datetime_to_gregorian_seconds(to_datetime(R)), | |
| New_seconds = R_seconds - R_offset + Tz_offset, | |
| Datetime = calendar:gregorian_seconds_to_datetime(New_seconds), | |
| {ok, New_R} = from_datetime(Datetime), | |
| New_R#timestamp{timezone = Tz, fraction = R#timestamp.fraction}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package HP::Logger; | |
| BEGIN { | |
| use FindBin qw($Bin $Script); | |
| $Script =~ s/.pl//; | |
| unshift @INC, "$Bin/../lib/perl"; | |
| unshift @INC, "$Bin/../lib/mt/extlib"; | |
| } | |
| use Exporter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Setting loggers | |
| log4perl.logger.ConsoleFile=INFO, Console, File | |
| log4perl.logger.Console=INFO, Console | |
| log4perl.rootLogger=INFO, Console, File | |
| # File appender | |
| log4perl.appender.File=Log::Log4perl::Appender::File | |
| log4perl.appender.File.filename= sub { HP::Logger::get_log_file_name(); } | |
| log4perl.appender.File.mode=append |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub _hdlr_entry_body_has_image { | |
| my($ctx, $args, $cond) = @_; | |
| return 0 if (!$ctx->stash('entry')); | |
| my $entry_text = &MT::Template::Context::_hdlr_entry_body; | |
| my @paragraphs = split(/<p[^>]*>/i, $entry_text); | |
| ## just checking for img tag in the | |
| ## first three paragraphs, skip first array element, | |
| ## because of that element is fake element |