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) -> | |
| 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
| вот так | |
| 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(<<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
| //checking for existing corresponding row in mt_entry_extra | |
| if (!self::IsEntryExtraExist($_REQUEST['entry_id'])) { | |
| self::InsertEntryExtra($_REQUEST['entry_id']); | |
| } | |
| if ($_REQUEST['blog_id'] == 3) { | |
| $extra_values = array('entry_extra_show_tweets' => $extra_value['entry_extra_show_tweets'] ); | |
| } | |
| $affectedRows = self::$Dbh->extended->autoExecute("mt_entry_extra", $extra_values, MDB2_AUTOQUERY_UPDATE, "entry_extra_id=".self::$Dbh->quote($_REQUEST['entry_id'])); |
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
| if ($_REQUEST['blog_id'] == 2 || $_REQUEST['blog_id'] == 18) | |
| { | |
| //checking for existing corresponding row in mt_entry_extra | |
| if (!self::IsEntryExtraExist($_REQUEST['entry_id'])) | |
| { | |
| self::InsertEntryExtra($_REQUEST['entry_id']); | |
| } | |
| // insert extra data | |
| $affectedRows = self::$Dbh->extended->autoExecute("mt_entry_extra", $extra_values, MDB2_AUTOQUERY_UPDATE, "entry_extra_id=".self::$Dbh->quote($_REQUEST['entry_id'])); | |
| } |
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
| MT::App::CMS->add_callback('CMSPreSave_entry', 9, $plugin, sub { | |
| my ($eh, $app, $entry) = @_; | |
| my $q = $app->{'query'}; | |
| # Only AP entries from Wires blog here | |
| return 1 unless $entry->blog_id == 18; | |
| return 1 unless $entry->author->name eq 'AP'; | |
| my $extra = huff::EntryExtra->load($entry->id); | |
| return 1 if $extra->ap_edited; |
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
| tick_to_json_object(Rec) when is_record(Rec, tick) -> | |
| Keys = [ <<"timestamp">>, <<"value">> ], | |
| {_Series_id, Timestamp} = Rec#tick.id, | |
| Value = Rec#tick.value, | |
| {struct, lists:zip(Keys, [Timestamp, Value])}; | |
| tick_to_json(Tick) -> | |
| Encode = mochijson2:encoder([{utf8, true}]), | |
| try | |
| List = case Tick of |
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
| tick_list_from_json(Series_id, Json) -> | |
| try mochijson2:decode(Json) of | |
| List when is_list(List) -> | |
| [ json_struct_to_tick(Series_Id, P) || P <- List ]; | |
| Struct when is_tuple(Struct) -> | |
| [ json_struct_to_tick(Series_Id, Struct) ] | |
| catch | |
| _Any -> | |
| {error, bad_json} | |
| end. |