亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? object.pm

?? 1. 記錄每個(gè)帖子的訪問人情況
?? PM
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
# Copyright 2001-2005 Six Apart.# SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS## $Id: Object.pm 10831 2005-03-30 23:27:06Z ezra $package MT::Object;use strict;use MT::ObjectDriver;use MT::ErrorHandler;@MT::Object::ISA = qw( MT::ErrorHandler );## Magic.sub install_properties {    my $class = shift;    no strict 'refs';    ${"${class}::__properties"} = shift;}sub properties {    my $this = shift;    my $class = ref($this) || $this;    no strict 'refs';    ${"${class}::__properties"};}## Drivers.use vars qw( $DRIVER );sub set_driver { $DRIVER = MT::ObjectDriver->new($_[1]) }sub driver { $DRIVER }sub set_callback_routine { shift; $DRIVER->set_callback_routine(@_) }## Callbackssub add_callback {    my $class = shift;    my($meth, $priority, $plugin, $code) = @_;    if (ref$code ne 'CODE') {	return $class->error("4th argument to add_callback must be "			     . "a perl CODE reference");    }    MT->add_callback($class . '::' . $meth, $priority, $plugin, $code);    1;}## Construction/initialization.sub new {    my $class = shift;    my $obj = bless {}, $class;    $obj->init(@_);}sub init {    my $obj = shift;    my %arg = @_;    $obj->{'column_values'} = {};    $obj;}sub clone {    my $obj = shift;    my $clone = ref($obj)->new();    $clone->set_values($obj->column_values);    $clone;}sub column_names {    my $obj = shift;    my $props = $obj->properties;    my @cols = @{ $props->{columns} };    push @cols, qw( created_on created_by modified_on modified_by )        if $props->{audit};    \@cols;}sub datasource { $_[0]->properties->{datasource} }sub column_values { $_[0]->{'column_values'} }sub column {    my $obj = shift;    my($col, $value) = @_;    return unless defined $col;    $obj->{'column_values'}->{$col} = $value if defined $value;    $obj->{'column_values'}->{$col};}sub created_on_obj {    my $obj = shift;    if (my $ts = $obj->created_on) {        my $blog;        if ($obj->isa('MT::Blog')) {            $blog = $obj;        } else {            if (my $blog_id = $obj->blog_id) {                require MT::Blog;                $blog = MT::Blog->load($blog_id);            }        }        my($y, $mo, $d, $h, $m, $s) = $ts =~ /(\d\d\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)/;        require MT::DateTime;        my $four_digit_offset;        if ($blog) {            $four_digit_offset = sprintf('%.02d%.02d', int($blog->server_offset),                                        60 * abs($blog->server_offset                                                 - int($blog->server_offset)));        }        return new MT::DateTime(year => $y, month => $mo, day => $d,                                hour => $h, minute => $m, second => $s,                                time_zone => $four_digit_offset);    }    undef;}sub set_values {    my $obj = shift;    my($values) = @_;    my @cols = @{ $obj->column_names };    for my $col (@cols) {        next unless exists $values->{$col};        $obj->column($col, $values->{$col});    }}sub _mk_passthru {    my($method) = @_;    sub {        my($this) = $_[0];        die "No ObjectDriver defined" unless defined $DRIVER;        my $class = ref($this) || $this;	if (wantarray) {	    my @result = eval {		my @rc = $DRIVER->$method(@_);		@rc or return $this->error( $DRIVER->errstr );		return @rc;	    }; if ($@) {		$@ =~ s/\s*at.*$//s;		require Carp;		Carp::croak($@);	    }	    return @result;	} else {	    my $result = eval {		my $rc = $DRIVER->$method(@_);		defined $rc or return $this->error( $DRIVER->errstr );		return $rc;	    }; if ($@) {		$@ =~ s/\s*at.*$//s;		require Carp;		Carp::croak($@);	    }	    return $result;	}    }}{    no strict 'refs';    *load = _mk_passthru('load');    *load_iter = _mk_passthru('load_iter');    *save = _mk_passthru('save');    *remove = _mk_passthru('remove');    *remove_all = _mk_passthru('remove_all');    *exists = _mk_passthru('exists');    *count = _mk_passthru('count');    *count_group_by = _mk_passthru('count_group_by');}sub set_by_key {    my $class = shift;    my ($key, $value) = @_;    my $obj = $class->load($key);    $obj ||= new $class;    $obj->set_values($key);    foreach my $col (keys %$value) {        $obj->column($col, $value->{$col});    }    $obj->save();    $obj;}sub DESTROY { }use vars qw( $AUTOLOAD );sub AUTOLOAD {    my $obj = $_[0];    (my $col = $AUTOLOAD) =~ s!.+::!!;    no strict 'refs';    my $class = ref($obj);    *$AUTOLOAD = sub {        shift()->column($col, @_);    };    goto &$AUTOLOAD;}1;__END__=head1 NAMEMT::Object - Movable Type base class for database-backed objects=head1 SYNOPSISCreating an I<MT::Object> subclass:    package MT::Foo;    use strict;    use MT::Object;    @MT::Foo::ISA = qw( MT::Object );    __PACKAGE__->install_properties({        columns => [            'id', 'foo',        ],        indexes => {            foo => 1,        },        datasource => 'foo',    });Using an I<MT::Object> subclass:    use MT;    use MT::Foo;    ## Create an MT object to load the system configuration and    ## initialize an object driver.    my $mt = MT->new;    ## Create an MT::Foo object, fill it with data, and save it;    ## the object is saved using the object driver initialized above.    my $foo = MT::Foo->new;    $foo->foo('bar');    $foo->save        or die $foo->errstr;=head1 DESCRIPTIONI<MT::Object> is the base class for all Movable Type objects that will beserialized/stored to some location for later retrieval; this location couldbe a DBM file, a relational database, etc.Movable Type objects know nothing about how they are stored--they know onlyof what types of data they consist, the names of those types of data (theircolumns), etc. The actual storage mechanism is in the I<MT::ObjectDriver>class and its driver subclasses; I<MT::Object> subclasses, on the other hand,are essentially just standard in-memory Perl objects, but with a little extraself-knowledge.This distinction between storage and in-memory representation allows objectsto be serialized to disk in many different ways--for example, an object couldbe stored in a MySQL database, in a DBM file, etc. Adding a new storage methodis as simple as writing an object driver--a non-trivial task, to be sure, butone that will not require touching any other Movable Type code.=head1 SUBCLASSINGCreating a subclass of I<MT::Object> is very simple; you simply need todefine the properties and metadata about the object you are creating. Startby declaring your class, and inheriting from I<MT::Object>:    package MT::Foo;    use strict;    use MT::Object;    @MT::Foo::ISA = qw( MT::Object );Then call the I<install_properties> method on your class name; an easy wayto get your class name is to use the special I<__PACKAGE__> variable:    __PACKAGE__->install_properties({        columns => [            'id', 'foo',        ],        indexes => {            foo => 1,        },        datasource => 'foo',    });I<install_properties> performs the necessary magic to install the metadataabout your new class in the MT system. The method takes one argument, a hashreference containing the metadata about your class. That hash reference canhave the following keys:=over 4=item * columnsThe definition of the columns (fields) in your object. Column names are alsoused for method names for your object, so your column name should notcontain any strange characters. (It could also be used as part of the name ofthe column in a relational database table, so that is another reason to keepcolumn names somewhat sane.)The value for the I<columns> key should be a reference to an array containingthe names of your columns.=item * indexesSpecifies the column indexes on your objects; this only has consequence forsome object drivers (DBM, for example), where indexes are not automaticallymaintained by the datastore (as they are in a relational database).The value for the I<indexes> key should be a reference to a hash containingcolumn names as keys, and the value C<1> for each key--each key representsa column that should be indexed.B<NOTE:> with the DBM driver, if you do not set up an index on a column youwill not be able to select objects with values matching that column using theI<load> and I<load_iter> interfaces (see below).=item * auditAutomatically adds bookkeeping capabilities to your class--each object willtake on four new columns: I<created_on>, I<created_by>, I<modified_on>, andI<modified_by>. These columns will be filled automatically with the propervalues.B<NOTE:> I<created_by> and I<modified_by> are not currently used.=item * datasourceThe name of the datasource for your class. The datasource is a name uniquelyidentifying your class--it is used by the object drivers to construct tablenames, file names, etc. So it should not be specific to any one driver.=back=head1 USAGE=head2 System InitializationBefore using (loading, saving, removing) an I<MT::Object> class and itsobjects, you must always initialize the Movable Type system. This is donewith the following lines of code:    use MT;    my $mt = MT->new;Constructing a new I<MT> objects loads the system configuration from theF<mt.cfg> configuration file, then initializes the object driver that willbe used to manage serialized objects.=head2 Creating a new objectTo create a new object of an I<MT::Object> class, use the I<new> method:    my $foo = MT::Foo->new;I<new> takes no arguments, and simply initializes a new in-memory object.In fact, you need not ever save this object to disk; it can be used as apurely in-memory object.=head2 Setting and retrieving column valuesTo set the column value of an object, use the name of the column as a methodname, and pass in the value for the column:    $foo->foo('bar');The return value of the above call will be C<bar>, the value to which you haveset the column.To retrieve the existing value of a column, call the same method, but withoutan argument:    $foo->fooThis returns the value of the I<foo> column from the I<$foo> object.=head2 Saving an objectTo save an object using the object driver, call the I<save> method:    $foo->save;On success, I<save> will return some true value; on failure, it will returnC<undef>, and you can retrieve the error message by calling the I<errstr>method on the object:    $foo->save        or die "Saving foo failed: ", $foo->errstr;If you are saving objects in a loop, take a look at the L<Note on ObjectLocking>.=head2 Loading an existing object or objectsYou can load an object from the datastore using the I<load> method. I<load>is by far the most complicated method, because there are many different waysto load an object: by ID, by column value, by using a join with another typeof object, etc.In addition, you can load objects either into an array (I<load>), or by usingan iterator to step through the objects (I<load_iter>).I<load> has the following general form:    my @objects = CLASS->load(\%terms, \%arguments);I<load_iter> has the following general form:    my $iter = CLASS->load_iter(\%terms, \%arguments);Both methods share the same parameters; the only difference is the manner inwhich they return the matching objects.If you call I<load> in scalar context, only the first row of the array

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡高清视频专区| 老鸭窝一区二区久久精品| 成人精品gif动图一区| 久久久激情视频| 国产成人av一区二区| 国产情人综合久久777777| 成人高清在线视频| 亚洲三级在线观看| 欧美性高清videossexo| 日韩极品在线观看| 亚洲精品在线网站| 成人aa视频在线观看| 亚洲精品你懂的| 91 com成人网| 黑人巨大精品欧美一区| 国产精品久久久久久一区二区三区| 99精品在线免费| 亚洲国产精品麻豆| 欧美xxxx在线观看| 91在线看国产| 日韩精品国产欧美| 国产欧美综合色| 欧美日韩在线免费视频| 激情五月激情综合网| 中文字幕一区免费在线观看| 欧美视频一区在线| 久久99精品国产麻豆婷婷| 国产精品麻豆视频| 日韩欧美一区电影| www.日韩精品| 蜜桃视频在线一区| 中文字幕在线视频一区| 3d动漫精品啪啪| 成人激情小说网站| 免费黄网站欧美| 亚洲伦理在线精品| 精品电影一区二区| 欧美日韩在线播| 成人动漫视频在线| 麻豆国产精品一区二区三区| 亚洲色大成网站www久久九九| 日韩精品一区二区三区在线播放| 99r国产精品| 国产一区二区美女诱惑| 日精品一区二区三区| 亚洲图片另类小说| 久久久美女毛片| 欧美高清激情brazzers| 92国产精品观看| 国产老女人精品毛片久久| 亚洲va欧美va人人爽| 中文字幕一区二区三区不卡| 精品美女在线播放| 8x8x8国产精品| 欧美亚洲日本国产| 99久久精品99国产精品| 国产美女视频一区| 久久激情五月激情| 日韩高清一区二区| 亚洲国产精品久久久男人的天堂| 国产精品午夜在线| 国产日产亚洲精品系列| 精品99一区二区| 欧美一区二区三区在线电影| 色狠狠一区二区三区香蕉| www.亚洲在线| 99视频热这里只有精品免费| 国产一区二区三区免费观看| 精东粉嫩av免费一区二区三区| 亚洲电影第三页| 一区二区三区不卡在线观看| 亚洲色图制服诱惑| 亚洲欧美另类小说视频| 国产精品久久久久久久久图文区| 久久精品一区二区三区不卡牛牛 | 激情偷乱视频一区二区三区| 亚洲影院在线观看| 亚洲国产精品尤物yw在线观看| 亚洲青青青在线视频| 国产精品久久久久aaaa| 国产精品国产三级国产普通话三级| 国产欧美1区2区3区| 国产精品美女视频| 中文字幕综合网| 一区二区三区精品| 午夜精彩视频在线观看不卡| 香蕉久久一区二区不卡无毒影院| 亚洲一本大道在线| 日韩精品国产欧美| 激情六月婷婷综合| 岛国一区二区三区| 一本大道久久a久久综合| 色哟哟在线观看一区二区三区| 欧美在线一区二区| 国产欧美日韩亚州综合| 国产精品久久久久久久裸模| 亚洲欧美日韩在线| 婷婷综合五月天| 国内外成人在线视频| 成人av在线电影| 色婷婷精品大在线视频 | 亚洲已满18点击进入久久| 亚洲最大成人网4388xx| 日韩综合在线视频| 国产精品一区专区| 色偷偷久久人人79超碰人人澡| 欧美日韩成人一区二区| 精品国产乱码久久久久久夜甘婷婷| 国产欧美精品在线观看| 一区二区国产视频| 蜜桃视频一区二区三区 | 蜜臀av一级做a爰片久久| 国产98色在线|日韩| 欧美午夜一区二区三区免费大片| 欧美一区二区不卡视频| 中文字幕av一区二区三区高| 亚洲一区二区视频在线观看| 日本不卡视频一二三区| av午夜一区麻豆| 日韩一区二区视频在线观看| 国产精品欧美精品| 蜜桃av一区二区| a亚洲天堂av| 日韩一区二区精品在线观看| 国产精品久久久久久久午夜片| 午夜精品久久久久久久| 成人久久18免费网站麻豆| 777亚洲妇女| 亚洲丝袜精品丝袜在线| 精品一区二区综合| 在线中文字幕不卡| 欧美国产一区视频在线观看| 天使萌一区二区三区免费观看| a级精品国产片在线观看| 91麻豆精品国产91久久久更新时间| 国产欧美一区二区在线观看| 日本va欧美va瓶| 91福利视频久久久久| 中文一区二区在线观看| 久久精品国产99| 欧美精品在线观看播放| 亚洲日穴在线视频| 懂色av中文字幕一区二区三区| 欧美一区二区大片| 亚洲.国产.中文慕字在线| av午夜精品一区二区三区| 久久久青草青青国产亚洲免观| 日韩综合一区二区| 欧美熟乱第一页| 一区二区三区中文字幕| 99久久精品国产观看| 亚洲国产精品激情在线观看| 久热成人在线视频| 国产成人精品免费网站| 久久综合九色综合欧美亚洲| 日av在线不卡| 欧美一卡二卡在线观看| 亚洲福利视频一区| 欧美丝袜丝交足nylons| 夜夜嗨av一区二区三区四季av| 91免费国产在线| 中文字幕亚洲成人| 不卡欧美aaaaa| 日韩一区日韩二区| 99国产精品国产精品久久| 国产精品乱人伦| 99精品视频一区二区三区| 中文字幕免费不卡在线| 国产ts人妖一区二区| 国产精品视频观看| av色综合久久天堂av综合| 中文字幕亚洲电影| 色哟哟日韩精品| 亚洲成人一区二区| 91麻豆精品久久久久蜜臀| 日本中文一区二区三区| 日韩亚洲电影在线| 国产综合久久久久久鬼色| 国产日韩欧美一区二区三区乱码 | 国产欧美一区二区精品秋霞影院| 国产一区二区在线看| 中文字幕精品综合| 91激情五月电影| 首页国产丝袜综合| 久久一区二区三区四区| 成人一级黄色片| 一区二区三区免费网站| 91精品国产欧美一区二区成人| 久国产精品韩国三级视频| 国产三级一区二区三区| av中文字幕一区| 亚洲高清免费一级二级三级| 欧美一区二区日韩| 风间由美一区二区三区在线观看 | 91美女福利视频| 亚洲v中文字幕| 精品久久一区二区| 99久久久无码国产精品| 亚洲自拍偷拍麻豆| 欧美精品一区二区三区高清aⅴ|